home *** CD-ROM | disk | FTP | other *** search
/ SGI Developer Toolbox 6.1 / SGI Developer Toolbox 6.1 - Disc 4.iso / FAQs / netfaqs / motif-faq < prev    next >
Text File  |  1994-08-01  |  265KB  |  6,601 lines

  1.  
  2. Newsgroups: comp.windows.x.motif,news.answers,comp.answers
  3. From: dealy@kong.gsfc.nasa.gov (Brian Dealy)
  4. Subject: Motif FAQ
  5. Date: 14 Apr 1994 15:20:33 -0400
  6. Organization: NASA/Goddard Space Flight Center
  7. Lines: 1020
  8. Approved: news-answers-request@MIT.Edu
  9. Distribution: inet
  10. Expires: +2 months
  11. Reply-To: dealy@kong.gsfc.nasa.gov (Brian Dealy)
  12. Summary: This posting contains a list of Frequently Asked Questions and their answers about Motif.
  13. Keywords: FAQ question answer
  14. Xref: bloom-beacon.mit.edu comp.windows.x.motif:15724 news.answers:18057 comp.answers:4908
  15.  
  16. Archive-name: motif-faq/part1
  17. Last-modified: APR 04, 1994
  18. Version: 3.6
  19.  
  20.  
  21. Motif FAQ
  22.  
  23. [Last changed: 04 APR 94]
  24.  
  25. This article contains the answers to some Frequently Asked Questions (FAQ) 
  26. often seen in comp.windows.x.motif. It is posted to help reduce volume in 
  27. this newsgroup and to provide hard-to-find information of general interest.
  28.  
  29.         Please redistribute this article!
  30.  
  31. This FAQ is maintained by Brian Dealy <dealy@kong.gsfc.nasa.gov>.  Send
  32. updates and corrections to me at that mail address.  It would help if
  33. the subject line contained the phrase "FAQ".  I will Be making a
  34. HTML version available in the very near (MAY)? future. It will hopefully 
  35. provide a much fuller set of resources including URLs for examples and 
  36. free software. It will require a bit of reorganizing and rewriting, but 
  37. it should be well worth the wait.
  38.  
  39. History:
  40. From November 89-July 93 the FAQ was maintained by Jan Newmarch
  41. <jan@ise.canberra.edu.au>
  42.  
  43. This article includes answers to the following questions. Ones marked with
  44. a + indicate questions new to this issue; those with changes of content since
  45. the last issue are marked by *:
  46.  
  47.  
  48.  0)* TOPIC: WHAT ARE OTHER RELEVANT NEWSGROUPS?
  49.  1)  TOPIC: FTP ARCHIVES
  50.  2)  Is the FAQ list available for FTP anywhere?
  51.  3)* Is this FAQ accessible via WWW?
  52.  4)  Is this newsgroup accessible via email?
  53.  5)  Is this newsgroup archived?
  54.  6)  Is the mail list motif-talk archived?
  55.  7)  TOPIC: OSF AND MOTIF
  56.  8)  Because of COSE, is Motif now in the public domain?
  57.  9)* What versions of Motif are there?
  58. 10)* Where can I get Motif?
  59. 11)  Is there a list of Motif bugs?
  60. 12)  Where can I get public domain Motif source?
  61. 13)* Are the Motif examples publically available?
  62. 14)* Has anyone done a public domain Motif lookalike?
  63. 15)  Does anyone from OSF pay attention to our questions/suggestions?
  64. 16)  Does OSF have an application compliance validation service?
  65. 17)  What is the motif-talk mailing list?
  66. 18)  What MIT patches do I use, and when do I use fix-osf?
  67. 19)  How does Motif work with X11R5?
  68. 20)* How can I find which version of Motif I have?
  69. 21)  TOPIC: LITERATURE
  70. 22)* What books should I read or do I need to program using Motif?
  71. 23)  TOPIC: MWM
  72. 24)  What is the difference between Motif and mwm?
  73. 25)  Does anyone have an alternative set of  3-D  defaults  for  a  monochrome
  74. screen?
  75. 26)  How can I modify the Motif window manager decorations?
  76. 27)  How can I turn off the Motif window manager  functions  from  the  system
  77. menu?
  78. 28)  How can tell I if the user has selected the "Close" item  on  the  system
  79. menu attached to the top-level shell?
  80. 29)  Is there an mwm virtual desktop manager?
  81. 30)  Why does mwm 1.2 crash on startup?
  82. 31)  TOPIC: MOTIF GENERATORS
  83. 32)  What prototyping tools are there to generate Motif code?
  84. 33)  TOPIC: TEXT WIDGET
  85. 34)  What is the difference between a XmTextField widget and a single
  86. 35)  Why does  pressing  <return> in a text widget do nothing?
  87. 36)  When I add text to a scrolling text widget how can I get the new text  to
  88. show?
  89. 37)  Does the text widget support 16 bit character fonts?
  90. 38)  How can I stop the text widget from echoing characters typed?
  91. 39)  How can I replace characters typed with say a `*'?
  92. 40)  How can I best add a large piece of text to a scrolled text widget?
  93. 41)  How can I highlight text in the Text widget?
  94. 42)  How can I select all of the text in a widget programmatically?
  95. 43)  How can I change colours of text in the Text widget?
  96. 44)  How can I change the font of text in the Text widget?
  97. 45)  Is there an emacs binding for the text widget?
  98. 46)  How can I use a file as the text source for a Text widget?
  99. 47)  How can put Text in overstrike mode instead of insert?
  100. 48)  How can I make the Delete key do a backspace?
  101. 49)  TOPIC: LIST WIDGET
  102. 50)  Should I create an XmList widget as a child of automatic  
  103.      XmScrolledWindow or use the XmCreateScrolledList() convenience function?
  104. 51)  How do I best put a new set of items into a list?
  105. 52)  Can I have strings with different fonts in a list?
  106. 53)  Can I get a bitmap to show in a list item like I can in a Label?
  107. 54)  Can I have items with different colours in a list?
  108. 55)  Can I grey out an item in a list?
  109. 56)  Can I have multi-line items in a list?
  110. 57)  How can I tell the position of selected items in a list?
  111. 58)  TOPIC: FILE SELECTION BOX WIDGET
  112. 59)  What is libPW.a and do I need it?
  113. 60)  What are these compile errors: Undefined symbol _regcmp and _regex?
  114. 61)  What's wrong with the Motif 1.0 File Selection Box?
  115. 62)  TOPIC: FORM WIDGET
  116. 63)  Why don't labels in a Form resize when the label is changed?
  117. 64)  How can I center a widget in a form?
  118. 65)  How do I line up two columns of widgets of different types?
  119. 66)  TOPIC: PUSHBUTTON WIDGET
  120. 67)  Why can't I use accelerators on buttons not in a menu?
  121. 68)  TOPIC: LABEL WIDGET
  122. 69)  How can I align the text in a label (button, etc) widget?
  123. 70)  Why doesn't label alignment work in a RowColumn?
  124. 71)  How can I set a multiline label?
  125. 72)  How can I have a vertical label?
  126. 73)  How can I have a Pixmap in a Label?
  127. 74)  TOPIC: DRAWING AREA WIDGET
  128. 75)  How can I send an expose event to a Drawing Area widget?
  129. 76)  How can I know when a DrawingArea has been resized?
  130. 77)  TOPIC: MENUS
  131. 78)  What can I put inside a menu bar?
  132. 79)  Can I have a cascade button without a submenu in a pulldown menu?
  133. 80)  Should I have a cascade button without a submenu in a pulldown menu?
  134. 81)  What is the best way to create popup menus?
  135. 82)  How do popup menus work?
  136. 83)  Should I use translation tables or actions for popup menus?
  137. 84)  What are the known bugs in popup menus?
  138. 85)  Can I have multiple popup menus on the same widget?
  139. 86)  TOPIC: INPUT FOCUS
  140. 87)  How can I specify the widget that should have the keyboard focus  when  my
  141.      application starts up?
  142. 88)  How can I direct the keyboard input to a particular widget?
  143. 89)  How can I have a modal dialog which has to be answered before the  
  144.      application can continue?
  145. 90)  TOPIC: MEMORY AND SPEED
  146. 91)  When can I free data structures passed to or retrieved from Motif?
  147. 92)  Why does my application grow in size?
  148. 93)  Why does my application take a long time to start up?
  149. 94)  My application is running too slowly. How can I speed it up?
  150. 95)  Why is my application so huge?
  151. 96)  TOPIC: XMSTRING
  152. 97)  How can I get the Ascii text out of an XmString?
  153. 98)  When can XmStrings used as resources be freed?
  154. 99)  Why doesn't XmStringGetNextSegment() work properly?
  155. 100)  Why does using XmStringDraw cause a Bad Font error?
  156. 101)  TOPIC: DIALOGS
  157. 102)  How do I stop my dialog disappearing when I press the help button?
  158. 103)  How do I make my own dialog?
  159. 104)  How come the title bars for my dialogs now have  "_popup"  or  
  160.       "<-popup" concatenated onto the widget name?
  161. 105)  How can I force a dialog window to display?
  162. 106)  How can I control placement of a popup widget?
  163. 107)  TOPIC: LANGUAGE BINDINGS
  164. 108)* Is there a C++ binding for Motif?
  165. 109)  How can I have a C++ member function in a callback?
  166. 110)  Is there a Common Lisp binding for Motif?
  167. 111)* Is there an Ada binding for Motif?
  168. 112)  Is there a Poplog binding for Motif?
  169. 113)  TOPIC: SPECIFIC PLATFORMS
  170. 114)  Is it easy to build Motif for a Sun?
  171. 115)  How do I build Motif 1.2.2 on Solaris 2.1 with Sun C?
  172. 116)  What compile errors/warnings might I get in both Sun 3 and Sun 4?
  173. 117)  On a Sun 3, what are the mwm startup error messages about?
  174. 118)  Are there problems making shared libraries on a Sun?
  175. 119)  The OpenWindows server hangs when I popup a menu with Button 3.
  176. 120)  Has anyone made shared libraries on an IBM RS/6000?
  177. 121)  What is the error  "Unaligned access in XmString" under Ultrix?
  178. 122)  TOPIC: KEYSYMS
  179. 123)  What is causing the messages "unknown keysym osfDown..."?
  180. 124)  What happens if I can't install Motif Keysyms?
  181. 125)  Why has OSF introduced Keysyms into Motif 1.1?
  182. 126)  TOPIC: ICONS
  183. 127)  How can I keep track of changes to iconic/normal window state?
  184. 128)  How can I check if my application has come up iconic?
  185. 129)  How can I start my application in iconic state?
  186. 130)  How can an application iconify itself?
  187. 131)  How can an application de-iconify itself?
  188. 132)  TOPIC: MISCELLANEOUS
  189. 133)+ How do I controll the repeat rate on a SUN keyboard ??
  190. 134)  How can I identify the children of a manager widget?
  191. 135)  How do I tell if a scrolled window's scrollbars are visible?
  192. 136)  How can I programatically scroll a XmScrolledWindow in XmAUTOMATIC mode?
  193. 137)  What functions can an application use to change the size or position  
  194.       of a widget?
  195. 138)  What widgets should I use to get the look of push buttons, but
  196. 139)+ How do I obtain the size of a unmanaged shell widget?
  197. 140)  Can  I  use  XtAddTimeOut(),  XtAddWorkProc(),  and  XtAddInput()  
  198.       with XtAppMainLoop()?
  199. 141)  Why does XtGetValues() XmNx and XmNwidth return extremely large values.
  200. 142)  Can I specify callback functions in resource files?
  201. 143)  How do I specify a search path for ".uid" files?
  202. 144)  XtGetValues() on XmNx and XmNy of my top level shell  don't  return  
  203.       the correct root window coordinates.  How do I compute these?
  204. 145)  Can I use XmGetPixmap() with widgets that have non-default visual types?
  205. 146)  How can I determine the item selected in a option menu or a RadioBox?
  206. 147)  What is the matter with Frame in Motif 1.2?
  207. 148)  What is IMUG and how do I join it?
  208. 149)  What is the X Professional Organization
  209. 150)  How do I set the title of a top level window?
  210. 151)  Can I use editres with Motif?
  211. 152)  How can I put decorations on transient windows using olwm?
  212. 153)  Why does an augment translation appear to act as replace for some 
  213.       widgets?
  214. 154)  How do you "grey" out a widget so that it cannot be activated?
  215. 155)  Why doesn't the Help callback work on some widgets?
  216. 156)  Where can I get a Table widget?
  217. 157)  Has anyone done a bar graph widget?
  218. 158)  Does anyone know of a source code of a graph widget
  219. 159)+ Is there a help system available, such as in Windows 3?
  220. 160)  Can I specify a widget in a resource file?
  221. 161)  Why are only some of my translations are being installed?
  222. 162)  Where can I get the PanHandler code?
  223. 163)  What are these passive grab warnings?
  224. 164)  How do I have more buttons than three in a box?
  225. 165)  How do I create a "busy working cursor"?
  226. 166)  Can I use the hourglass that mwm uses?
  227. 167)  What order should the libraries be linked in?
  228. 168)  How do I use xmkmf for Motif clients?
  229. 169)  How do I make context sensitive help?
  230. 170)  How do I debug a modal interaction?
  231. 171)+ How can I disable Drag and Drop in my Motif 1.2 client ?
  232. 172)  Where can I get info on the Motif drag and drop protocol?
  233. 173)  TOPIC: ACKNOWLEDGEMENTS
  234.  
  235.  
  236.  
  237.  
  238.  
  239.  
  240.  
  241.  
  242.  
  243.  
  244.  
  245.  
  246.  
  247. If you have suggestions or corrections for any of these answers or any 
  248. additional information, please send them directly to dealy@kong.gsfc.nasa.gov;
  249. the information will be included in the next revision (or possibly the one 
  250. after that; thanks for the many suggestions which haven't been incorporated 
  251. yet).  The answers in this iteration are acknowledged to be partial.
  252.  
  253. This posting is intended to be distributed at approximately the beginning of 
  254. each month.
  255.  
  256. The information contained herein has been gathered from a variety of sources. In
  257. many cases attribution has been lost; if you would like to claim responsibility
  258. for a particular item, please let us know. 
  259.  
  260. Conventions used below: telephone numbers tend to be Bell-system unless 
  261. otherwise noted; prices on items are not included.
  262. copyright 1993 b.dealy
  263.  
  264.  
  265.  
  266.  
  267.  
  268.  
  269.  
  270. -----------------------------------------------------------------------------
  271. Subject:  0)* TOPIC: WHAT ARE OTHER RELEVANT NEWSGROUPS?
  272.  
  273. [Last modified: Feb 93]
  274.  
  275. Answer: This newsgroup is comp.windows.x.motif.
  276.  
  277. The nearest related group is comp.windows.x.  It also maintains an FAQ, which
  278. deals in all sorts of X, Xlib and Xt questions. Look there for answers to
  279. questions such as "How do I get a screendump of my application?", "where do I
  280. get X11R4,X11R5, X11R6", etc.  Other groups which may have relevant
  281. information are comp.windows.x.pex, comp.windows.x.apps,
  282. comp.windows.x.intrinsics, comp.windows.news, comp.windows.misc and
  283. comp.windows.open-look.  The intrinsics and open-look groups also have an FAQ.
  284.  
  285. The newsgroup news.answers contains *lots* of FAQs (including this one).  Look
  286. there for lots of info on everything.
  287.  
  288. -----------------------------------------------------------------------------
  289. Subject:  1)  TOPIC: FTP ARCHIVES
  290.  
  291. -----------------------------------------------------------------------------
  292. Subject:  2)  Is the FAQ list available for FTP anywhere?
  293.  
  294. [Last modified: Dec 93]
  295.  
  296. Answer: A number of FAQ's (including this one) are available for anonymous ftp
  297. at rtfm.mit.edu, under the directory pub/usenet.  (Motif is under
  298. pub/usenet/comp.windows.x.motif and also under
  299. pub/usenet/comp/windows/x/motif) There is also a mail server called mail-
  300. server@rtfm.mit.edu.  To retrieve a file send mail to the server with a
  301. subject or body similar to
  302.  
  303.         send usenet/comp.windows.x.motif/Motif_FAQ_(Part_1_of_5).Z
  304.  
  305. This service is looked after by Jonathan Kamens (jik@rtfm.mit.edu).
  306.  
  307. It has also been placed in contrib/Motif-FAQ at
  308. ftp://ftp.x.org/contrib/Motif-FAQ
  309.  
  310. This files are also accessible from WAIS (Wide Area Information System) under
  311. UC-Motif-FAQ, allowing keyword-based searches of the FAQ.  ---------
  312. --------------------------------------------------------------------
  313. Subject:  3)+ Is this FAQ accessible via WWW?
  314.  
  315. [Last modified: Dec 93]
  316.  
  317. Answer: A simple version of the FAQ has been htmlized on news.answers But a
  318. more in-depth restructuring is under way and should be available soon at a web
  319. server near you.
  320.  
  321. -----------------------------------------------------------------------------
  322. Subject:  4)  Is this newsgroup accessible via email?
  323.  
  324. [Last modified: April 93]
  325.  
  326. Answer: An email link is maintained by Brian Dealy.  To join, send mail to
  327. motif-request@lobo.gsfc.nasa.gov.
  328.  
  329. -----------------------------------------------------------------------------
  330. Subject:  5)  Is this newsgroup archived?
  331.  
  332. [Last modified: November 1992]
  333.  
  334. Answer: The newsgroup files from August 1991 are available from
  335. csc.canberra.edu.au (137.92.1.1) by anonymous ftp.  They are in the directory
  336. /pub/motif/comp.windows.x.motif.
  337.  
  338. These files are also accessible from WAIS (Wide Area Information System) under
  339. comp.windows.x.motif, allowing keyword-based searches of the newsgroup
  340. articles (this time on machine services.canberra.edu.au (137.92.1.12)).
  341.  
  342. -----------------------------------------------------------------------------
  343. Subject:  6)  Is the mail list motif-talk archived?
  344.  
  345. Answer: If you have purchased support from OSF then you have access to their
  346. archive server for motif-talk.
  347.  
  348. -----------------------------------------------------------------------------
  349. Subject:  7)  TOPIC: OSF AND MOTIF
  350.  
  351. -----------------------------------------------------------------------------
  352. Subject:  8)  Because of COSE, is Motif now in the public domain?
  353.  
  354. Answer: The *specification* for Motif is no longer controlled by OSF, but by
  355. X/Open.  This does not affect the *implementation*. The implementation is
  356. still in the hands of OSF, and will not be released into the public domain.
  357. So no, the OSF source code will still only be available to those who buy a
  358. source code license from OSF.
  359.  
  360. The specification does not include UIL or obsolete features (ie 1.0 bugs in
  361. design), but these will continue to be supported by the OSF code.
  362.  
  363. -----------------------------------------------------------------------------
  364. Subject:  9)* What versions of Motif are there?
  365. [Last modified: March 93]
  366.  
  367. Answer: Motif 1.0 is based on the R3 toolkit.  There are patch releases to
  368. 1.0: 1.0.1, 1.0.A, 1.0.2 and 1.0.3, 1.0.4, 1.0.5. 1.0.A was a fairly major
  369. patch, as it involved a complete re-engineering of UIL and Mrm.  Almost
  370. everyone who has 1.0.x has either 1.0.A or 1.0.3.
  371.  
  372. Motif 1.1 is based on the R4 toolkit.  The intial version was Motif 1.1.0.
  373. Motif 1.1.1 has been released as a patch to licensees with Full Support or
  374. Technical Update service.  Motif 1.1.2 is a patch release which contains the
  375. necessary changes to fix over 80 bugs reported against Motif. It is available
  376. to support contract holders (including both full support and update service).
  377. The 1.1.3 release fixed a further 150 bugs and was available from August 1991
  378. to support contract holders (including both full support and update service).
  379. 1.1.4 offers X11R5 support, but is not an X11R5 product.  1.1.5 was released
  380. in June 92 to licensees who hold a Motif Full Support or Update Support
  381. contract
  382.  
  383. Motif 1.2.0 was released in April 1992 and is based on the X11R5 toolkit.  It
  384. offers increased compatibility with international standards,  PC-style
  385. behavior and binary compatibility with OSF/Motif 1.1 applications.  New
  386. features include drag-and-drop, tear- off menus, toolkit enhancements and new
  387. documentation.  toolkit.  The code is totally ANSI C.  OSF distributes a 10
  388. pages sheet entitled "OSF/Motif R1.1 to R1.2: detailed overview of changes",
  389. which is available from OSF Motif direct channels.  (617-621-7300 or email
  390. direct@osf.org)
  391.  
  392. Motif 1.2.1 was released September 92.  Due to an optimisation from 1.2.0 to
  393. 1.2.1 object code compiled under 1.2.1 (that is, using 1.2.1 header files)
  394. will not link with 1.2.0 libraries (and, very probably, clients that use
  395. shared libraries and are linked against 1.2.1 won't startup against 1.2).
  396.  
  397. Motif 1.2.2 was released March 93.  This release contains over 250 bug fixes,
  398. improved text, drag-and-drop features and has less than one reported defect
  399. per 1000 lines of code.
  400.  
  401. from dbrooks@osf.org Motif 1.2.3 was released on September 13, 1993.  The
  402. defect density is measured at < 0.8 known reports per thousand lines.  In this
  403. release, we have paid particular attention to memory leaks, and have improved
  404. drag-and-drop performance greatly.
  405.  
  406.  
  407. -----------------------------------------------------------------------------
  408. Subject: 10)* Where can I get Motif?
  409.  
  410. [Last modified: APR 94]
  411.  
  412. Answer:
  413.     Various hardware vendors produce developer's toolkits of binaries, header
  414. files, and documentation; check your hardware vendor, particularly if that
  415. vendor is an OSF member. Systems known to be shipping now: HP (sans UIL),
  416. Apollo (sans UIL), SCO, ICS, Mips (RISCwindows=X11R3 + full Motif), IBM, Data
  417. General for AViioNs (includes UIL), Bull (?), Concurrent Computer Corporation
  418. 5000, 6000, 8000 series machines, Convex, Sequent.
  419.  
  420.     In addition, independent binary vendors produce Motif toolkits .
  421.  
  422. [An FAQ is for "personal opinions" on these toolkits.  I don't think it is
  423. appropriate to give such opinions through this particular posting, so I
  424. haven't included any.]
  425.  
  426. Integrated Computer Solutions, Inc. (ICS) 201 Broadway, Cambridge, MA  02139
  427. USA info@ics.com   617/621-0060
  428.  
  429. ICS provides binary distributions of Motif for Sun platforms.  Other platforms
  430. are available as well, call or send mail for current info.  ICS also provides
  431. in-depth programming support for Motif and additional tools such as Builder
  432. Xcessory, a Motif interface builder, and the Widget Databook, a source for
  433. third party, commercially available and supported widgets, class libraries,
  434. and subsystems.
  435.  
  436. Quest (408-496-1900) sells kits for Suns, as well;
  437.  
  438. IXI (+44 223 236 555) offers kits for Sun3         (SunOS 3.5 or later, and
  439. Sun4         (SunOS 4.0.1 or later).         (Solaris 2.1 or later ( both
  440. SPARC  and Intel ))         ( both M1.1.5 and Motif 1.2.2 for SPARC, Motif
  441. 1.2.2 for Intel ).
  442.  
  443. Sun Microsystems is now shipping a version of Motif also.
  444.  
  445. NSL (+33 (1) 43 36 77 50; requests@nsl.fr) offers kits for the Sun 3 and Sun
  446. 4.
  447.  
  448.  
  449. In Australia, Information Technology Consultants Pty Ltd has Motif 1.1.2 for
  450. Sun Sparc 4.1 ( phone on (02) 360 6999, fax on (02) 360 6695 or e-mail to
  451. motif@itcsyd.itc.oz.au)
  452.  
  453. SILOGIC (+33 61.57.95.95), 78 chemin des Sept Deniers - 31200 TOULOUSE FRANCE
  454. sells Motif 1.1 and 1.2 on Sun4 machines. They also provide customers with
  455. Motif maintenance and support, and do consulting on the X window System at
  456. large, including software development.
  457.  
  458. METRO LINK INC., has Motif 1.2.3 and Motif 1.2.2 Runtime and Development
  459. packages available for a variety of operating systems.  All versions ship with
  460. shared library version of libXm.  Linux version includes free O'Reilly volume
  461. and FTP shipping option.  Send mail to:
  462.  
  463. Motif 1.2.3 (available Dec. 1, 1993)
  464.     Linux 0.99, Solaris 2.x (SPARC), SunOS 4.1.x      --->  $199.00
  465.     Solaris 2.1 (x86)                                 --->  $299.00
  466.  
  467. Motif 1.2.2
  468.     Linux 0.99, Solaris 2.x (SPARC), SunOS 4.1.x      --->  $199.00
  469.     QNX, SVR3, SVR4.[012], SCO, UnixWare, SINIX,
  470.     LynxOS, Venix, ISC, NCR SVR4 MP                   --->  Under $299.00
  471.  
  472. Metro Link Incorporated.  2213 W. McNab Rd. Pompano Beach,  Florida  33069
  473. Voice: +1.305.970.7353x412  Fax: +1.305.970.7351  Email: ken@metrolink.com
  474.  
  475.  
  476.  
  477.  
  478. BIM (Fax : +32(2)759.47.95) offer Motif 1.1 for Sun-3, Sun-4, Sun-386i.
  479. Includes shared libraries.
  480.  
  481. Metrolink Inc. (+1-305-566-9586, sales@metrolink.com; in Europe contact ADNT,
  482. (33 1) 3956 5333) ships an implementation of X11R4 and Motif 1.1 for several
  483. 386 systems.
  484.  
  485.     An OSF/Motif source license must be obtained from OSF before source can be
  486. obtained from the Open Software Foundation. Call the Direct Channel Desk at
  487. OSF at 617-621-7300 or email direct@osf.org for ordering information.
  488.  
  489. Bluestone offers Motif for $99.  Bluestone's  MWM is the compiled version of
  490. OSF/ Motif for Sun/SPARC. It is plain vanilla Motif based on X11 and Xt
  491. Intrinsics.  There is no license manager.  Platforms: Sun/OS 4.1+ and Solaris
  492. V2.1,2.2. Contact: Bluestone @609-727-4600
  493.  
  494. In addition to the full Motif source, "option C" allows you to purchase source
  495. for the window manager mwm to run on X terminals.
  496.  
  497.  
  498. -----------------------------------------------------------------------------
  499. Subject: 11)  Is there a list of Motif bugs?
  500.  
  501. Answer: With each patch release of Motif shipped, there is a list of known
  502. bugs provided.  The filename on the tape is "./OPENBUGS".  There is also a
  503. list of all the issues closed/resolved in that patch.  That is found as part
  504. of the "./README-1.1.n" (where n is the patch number) file.
  505.  
  506. These are the only OSF published lists.
  507.  
  508. No-one else seems to publish a list.
  509.  
  510.  
  511. -----------------------------------------------------------------------------
  512. Subject: 12)  Where can I get public domain Motif source?
  513.  
  514. Answer: You cannot.  Motif source is not publically available.
  515.  
  516.  
  517. -----------------------------------------------------------------------------
  518. Subject: 13)* Are the Motif examples publically available?
  519.  
  520. [Last modified: DEC 93]
  521.  
  522. Answer: OSF has produced a list of which of the example programs can be
  523. distributed. Call OSF Direct for a copy of it.  Most of the example programs
  524. have been freed from distribution limitations so should be available.
  525.  
  526. In addition to these, many programs on export.lcs.mit.edu in the contrib
  527. directory use Motif.  Source code posted to comp.sources.x often uses Motif.
  528.  
  529. The examples from Dan Heller's book are on export in
  530. /contrib/OReilly/motif/examples.tar.Z.  The examples from Thomas Berlages's
  531. book are on export in /contrib/berlage.motif.tar.Z The examples from Donald L.
  532. McMinds's book are on export in /contrib/mastering.motif.tar.Z The examples
  533. from Jan Newmarch's book are export in /contrib/newmarch.tar.Z The examples
  534. from Jerry Smith's book are on export in contrib/smith.motif.tar.Z
  535.  
  536. Also from a list maintained by: qizeng@acsu.buffalo.edu (Qi Y. Zeng) FTP sites
  537. for X/MOTIF source codes:
  538.  
  539.          ftp.uu.net
  540.                 published/brain.motif.tar.Z
  541.  
  542.          ftp.x.org
  543.                 contrib/young.C++.tar.Z
  544.  
  545.          ftp.x.org
  546.                 contrib/pwmxmpl.tar.Z
  547.  
  548.          ftp.x.org
  549.                 contrib/newmarch.tar.Z
  550.  
  551.          ora.com
  552.                 pub/examples/xresource
  553.  
  554.          skye.aiai.ed.ac.uk(192.41.104.6)
  555.                 pub/wxwin/wxwin150.tar.Z (UNIX)
  556.                 pub/wxwin/wxwin150.zip (PC)
  557.  
  558. -----------------------------------------------------------------------------
  559. Subject: 14)* Has anyone done a public domain Motif lookalike?
  560.  
  561. [Last modified: March 93]
  562.  
  563. Answer: Not yet.  The specification is available (AES), and the validation
  564. suite can be bought, but no-one has taken up the challenge.  There are some
  565. commercial lookalikes (Looking Glass and Neuron Data), but no workalikes.
  566.  
  567. Applications that follow the Style Guide might be certified Motif-compliant
  568. through the checklist process, even though they're not using OSF/Motif
  569. binaries.
  570.  
  571. Tcl/Tk is available for ftp from allspice.berkeley.edu, and although
  572. implemented without Xt, has a "strict Motif" mode.
  573.  
  574. Strom Sytems (18666 Redmond Way o-2118, Redmond, WA 98052-6725) have a Simple
  575. Toolkit for X-Windows (sic) that appears to follow the Style Guide even though
  576. it doesn't quite look like Motif.
  577.  
  578. MOOLIT is a USL product that can be runtime switched between the Sun Open Look
  579. and Motif appearance.  It is based on  OLIT 4i.
  580.  
  581. Interviews is a C++ based product with appearance similar to Motif.  A ftp-
  582. able version is on interviews.stanford.edu.  A commercial version is available
  583. as InterViews Plus.
  584.  
  585.  
  586. -----------------------------------------------------------------------------
  587. Subject: 15)  Does anyone from OSF pay attention to our questions/suggestions?
  588.  
  589. Answer: Yes, and they quite often post answers too. But they may not respond
  590. to *your* problem because they have other things to do as well.  This
  591. newsgroup is not run by OSF, and has no formal connection with OSF.  OSF is a
  592. member-driven company.  The membership (and anyone can be a member) provides
  593. the primary input for future development of Motif.
  594.  
  595. -----------------------------------------------------------------------------
  596. Subject: 16)  Does OSF have an application compliance validation service?
  597.  
  598. Answer: They have a checklist and a certification process which you can
  599. request from them.  Ask for the Level One Certification Checklist.  The
  600. process is one of self-certification.  It tests only the appearance and
  601. behavior of the application against Motif style.  The product will also be put
  602. in the OSF reference listing.  There's a one-time fee of $250.  According to
  603. the master license agreement, you can't use any OSF identifying mark unless
  604. you have done a certification.
  605.  
  606.  
  607. -----------------------------------------------------------------------------
  608. Subject: 17)  What is the motif-talk mailing list?
  609.  
  610. Answer: The motif-talk mailing list is only for those who have purchased a
  611. Motif source code license. You can be placed on this list by emailing to
  612. motif-talk-request@osf.org, citing your Company name and source license
  613. number.
  614.  
  615.  
  616.  
  617. -----------------------------------------------------------------------------
  618. Subject: 18)  What MIT patches do I use, and when do I use fix-osf?
  619.  
  620. Answer: The Motif 1.1.0 tape contains MIT patches 1-14. Apply these and any
  621. others you can get.  If your MIT patch level only goes up to fix-16, you also
  622. need to apply fix-osf.  Fix-osf was an emergency patch for a problem that
  623. existed when the Motif 1.1 tape was cut, The MIT fix-17 completely superseded
  624. osf-fix, so if you have applied fix-17 do not apply fix-osf.  The 1.1.1 tape
  625. contains MIT fixes 15-18, as well as an OSF-developed fix that deals with a
  626. subtle bug in the Selection mechanism of the Intrinsics.  Most people will
  627. have fix-15 to 18 by now; if you don't have them:
  628.  
  629.         Back out fix-osf if you have applied it
  630.         Apply fix-15 to 18
  631.         Apply fix-osf-1.1.1
  632.  
  633. The Selection fix was submitted to MIT, who came up with a different fix.  It
  634. will not be made into an R4 fix but should be in R5. The MIT fix was posted to
  635. motif-talk.
  636.  
  637.  
  638. -----------------------------------------------------------------------------
  639. Subject: 19)  How does Motif work with X11R5?
  640.  
  641. Answer: Motif 1.1.X is only intended to be built with X11R4.  Motif 1.2.X is
  642. for X11R5.  however, Motif 1.1.4 has been set to also work with X11R5.
  643.  
  644. For Motif 1.1.1, 1.1.2 and 1.1.3 you will need to compile Xlib and Xt with a
  645. MOTIFBC flag set to YES (page 8, section 3.3 of the R5 release notes), or
  646. you'll also have a link problem (LowerCase) and a fatal run time problem
  647. (XContext manager).  If your applications come up with "Unknown keysym name:
  648. osfActivate" errors, check the variable ProjectRoot. The name
  649. /$PROJECTROOT/lib/XKeysymDB will have been wired into your Xlib.
  650.  
  651. In Motif 1.1.0, XtCallCallback uses NULL as the first argument instead of a
  652. widget ID. This was ok under R4, but must be changed in the source for R5. It
  653. was changed by OSF from Motif 1.1.1 onward.
  654.  
  655. Mrm won't work at all (can't link since it uses an X private variable that has
  656. disappeared in R5).  Thre is an MIT patch that may fix this??  [I confess
  657. ignorance of Mrm and UIL].
  658.  
  659. -----------------------------------------------------------------------------
  660. Subject: 20)* How can I find which version of Motif I have?
  661.  
  662. [Last modified: October 93]
  663.  
  664. Answer: The macro XmVERSION gives you the version number.  The macro
  665. XmREVISION gives you the major revision number.  The macro XmVersion combines
  666. these e.g. a value of 1002 is Motif 1.2.
  667.  
  668. To find the minor revision number is not easy.  From Motif 1.1.3 onwards, try
  669. this:
  670.  
  671.    'strings `which mwm` | grep OSF'.
  672.  
  673. to get the full version number e.g. 1.1.3.
  674.  
  675. In Motif 1.2, the macro XmUPDATE_LEVEL was added to give the minor revision
  676. number.
  677.  
  678. + ( above also known as the patch level).  + In addition there was a macro
  679. string added,  XmVERSION_STRING which has all + the above info in a char
  680. string.
  681.  
  682. + grepping through a strings of libXm.a for OSF can also sometime give +
  683. something useful.
  684.  
  685. Version X11R6 is due out in spring of 1994 (april 15?)
  686.  
  687. thanks to hops@x.co.uk Mike Hopkirk
  688.  
  689. -----------------------------------------------------------------------------
  690. Subject: 21)  TOPIC: LITERATURE
  691.  
  692. -----------------------------------------------------------------------------
  693. Subject: 22)* What books should I read or do I need to program using Motif?
  694.  
  695. [Last modified: April 93]
  696.  
  697. Answer: Ken Lee of the DEC Western Software Laboratory (klee@wsl.dec.com)
  698. regularly posts to comp.windows.x and ba.windows.x a list of reference books
  699. and articles on X and X programming.  In FAQ comp.windows.x an extract of his
  700. list appears. Specifically for Motif programming, though:
  701.  
  702. OSF/Motif Programmers Guide, Prentice-Hall ISBN 13-640525-8 (Motif 1.0), ISBN
  703. 0-13-640681-5 (Motif 1.1), ISBN 0-13-643107-0 (Motif 1.2) (NB: This makes use
  704. of the demo programs that you get with a Motif source license.  The programs
  705. are not included and may or may not be available on your system.)
  706.  
  707. OSF/Motif Programmers Reference Manual, Prentice-Hall ISBN 13-640517-17 (Motif
  708. 1.0),
  709.  ISBN 0-13-640616-5 (Motif 1.1), ISBN 0-13-643115-1 (Motif 1.2) You will need
  710. this for the system calls.
  711.  
  712. OSF/Motif Style Guide, Prentice-Hall 13-640491-X (Motif 1.0), ISBN 0-13-
  713. 640673-4 (Motif 1.1), ISBN 13-643123-2 (Motif 1.2) You will need this to get
  714. some idea of how to write programs with the correct `look and feel'.
  715.  
  716. You should read at least one of the the non-OSF books on Motif:
  717.  
  718. Sebern, Mark "Building OSF/Motif Applications: A Practical Introduction". The
  719. ISBN is 0-13-122409-3. Prentice-Hall.
  720.  
  721. The book uses a large, realistic Motif application (a program to make slides
  722. for presentations) to demonstrate the use of Motif features. Both UIL and
  723. toolkit calls are discussed, though UIL is featured, both in the examples and
  724. in a reference chapter.
  725.  
  726. Young, Doug. "The X Window System: Applications and Programming with Xt (Motif
  727. Version)," Prentice Hall, 1989 (ISBN 0-13-497074-8). The excellent tutorial "X
  728. Window Systems Programming and Applications with Xt," (ISBN 0-13-972167-3)
  729. updated for Motif.
  730.  
  731. Marshall Brain at brain@adm.csc.ncsu.edu posted a set of simple and useful
  732. Motif tutorials.
  733.  
  734. Berlage, Thomas Berlage, OSF/Motif: Concepts and Programming, Addison-Wesley,
  735. UK, 1991. ISBN 0-201-55792-4.
  736.  
  737. Johnson, Eric F. and Kevin Reichard, Power Programming Motif, MIS: Press,
  738. Portland, OR, 1991. ISBN 1-55828-059-6. Book with disk, ISBN 1-55828-061-8.
  739.  
  740. Ferguson, Paula M, The Motif Reference Manual, Volume 6B of the O'Reilly
  741. series on X.  This is the new volume of a two volume set on Motif programming.
  742. ISBN 1-56592-038-4 (Motif 1.2)  (Volume 6A is expected to ship soon)
  743.  
  744. Barkakati, Nabajyoti, X Window System Programming, SAMS. ISBN 0-672-22750-9.
  745. This contains a section on Motif.
  746.  
  747. Smith, Jerry, Designing X Clients with Xt/Motif, ISBN 1-55860-255-0 Morgan
  748. Kaufmann Publishers This adopts a higher-level approach to many of the objects
  749. that commonly occur in Motif but are not in the Motif API.
  750.  
  751.  
  752. Newmarch, Jan, The X Window System and Motif - A Fast Track Approach.
  753. Addison-Wesley, ISBN 0-201-53931-4.
  754.  
  755. You will also need books and references on Xt such as:
  756.  
  757. Asente, Paul J., and Swick, Ralph R., "X Window System Toolkit, The Complete
  758. Programmer's Guide and Specification", Digital Press, 1990.  The bible on Xt.
  759. A treasury of information, excellent and invaluable.  Distributed by Digital
  760. Press, ISBN 1-55558-051-3, order number EY-E757E-DP; and by Prentice- Hall,
  761. ISBN 0-13-972191-6.
  762.  
  763. Nye, Adrian, and Tim O'Reilly, "X Toolkit Programming Manual, Volume 4,"
  764. O'Reilly and Associates, 1989. The folks at O'Reilly give their comprehensive
  765. treatment to programming with the MIT Intrinsics; R4 versions are now
  766. available, as is a Motif 1.1 version (Volume 4M).
  767.  
  768. Dan Heller's version of the Motif Programming Manual is still a widely used
  769. and useful book. It is being replaced by Volume 6a and 6b but is a very useful
  770. resource. Volume 6, Oreilly and Associates, Motif Edition.
  771.  
  772. Flanagan, David, ed.,  "X Toolkit Reference Manual, Volume 5," O'Reilly and
  773. Associates, 1992a, Third Edition. A professional reference manual for the MIT
  774. X11R4 and X11R5 Xt.
  775.  
  776. Books and reference manuals on Xlib may also be useful.
  777.  
  778. If you want to learn about UIL, look in the Motif Programmers's Guide.  This
  779. seems to be the only information.
  780.  
  781.  
  782. -----------------------------------------------------------------------------
  783. Subject: 23)  TOPIC: MWM
  784.  
  785. -----------------------------------------------------------------------------
  786. Subject: 24)  What is the difference between Motif and mwm?
  787.  
  788. Answer: mwm is a window manager. Motif itself is made up of four parts: a
  789. User-Interface Guideline, an API toolkit of `C' routines which helps in the
  790. building of applications which conform to the Guideline, the window manager
  791. mwm, and a language UIL which is designed to ease user interface development.
  792. In general mwm will run an application built with any X-windows API, and in
  793. general an application built using the Motif toolkit will run under any window
  794. manager.
  795.  
  796.  
  797. -----------------------------------------------------------------------------
  798. Subject: 25)  Does anyone have an alternative set of 3-D defaults for a
  799. monochrome screen?
  800.  
  801. Answer: This is obviously a matter of taste. Some alternatives suggested
  802. include
  803.  
  804. !Benjamin Schreiber, bs@osf.osf.org, bs@cs.brandeis.edu
  805. Mwm*foreground:                 black           ! Actually, when a window is
  806. Mwm*background:                 white           ! deactivated, the background
  807. Mwm*backgroundPixmap:           50_foreground   ! becomes white, insted of
  808. Mwm*topShadowPixmap:            white           ! 50% foreground (grey)
  809.  
  810. Mwm*activeForeground:           black
  811. Mwm*activeBackground:           white
  812. Mwm*activeBackgroundPixmap:     50_foreground
  813. Mwm*activeTopShadowPixmap:      white
  814.  
  815. Mwm*menu*backgroundPixmap:      background
  816. Mwm*menu*topShadowPixmap:       50_foreground
  817.  
  818. Mwm*title*foreground:                   black
  819. Mwm*title*background:                   white
  820. Mwm*title*backgroundPixmap:             white
  821. Mwm*title*topShadowPixmap:              50_foreground
  822. Mwm*title*activeForeground:             white
  823. Mwm*title*activeBackground:             black
  824. Mwm*title*activeBackgroundPixmap:       black
  825. Mwm*title*activeBottomShadowPixmap:     50_foreground
  826.  
  827. Mwm*feedback*backgroundPixmap:          white
  828.  
  829. or
  830.  
  831. ! From: tsang@isi.com (Kam C. Tsang)
  832. Mwm*background:                      White
  833. Mwm*activeBackground:                White
  834. Mwm*activeBackgroundPixmap:          25_foreground
  835. Mwm*foreground:                      Black
  836. Mwm*activeForeground:                Black
  837. Mwm*menu*background:                 white
  838. Mwm*menu*foreground:                 black
  839. xterm*Foreground:                    black
  840. xterm*Background:                    white
  841.  
  842.  
  843. or
  844.  
  845. ! From: ucsd.edu!usc!snorkelwacker!paperboy!yee  (Michael K. Yee)
  846. Mwm*cleanText:                          True
  847.  
  848. Mwm*activeBackground:           white
  849. Mwm*activeForeground:           black
  850. Mwm*background:                 white
  851. Mwm*foreground:                 black
  852.  
  853. Mwm*client*activeBackgroundPixmap:      50_foreground
  854. Mwm*client*activeTopShadowPixmap:       foreground
  855. Mwm*client*activeBottomShadowPixmap:    background
  856.  
  857. !Mwm*client*background:                 white
  858. !Mwm*client*foreground:                 black
  859. Mwm*client*backgroundPixmap:            75_foreground
  860. Mwm*client*topShadowPixmap:             foreground
  861. Mwm*client*bottomShadowPixmap:          background
  862.  
  863. !Mwm*feedback*background:               white
  864. !Mwm*feedback*foreground:               black
  865. Mwm*feedback*backgroundPixmap:          50_foreground
  866. !Mwm*feedback*topShadowPixmap:          25_foreground
  867. !Mwm*feedback*bottomShadowPixmap:       background
  868.  
  869. !Mwm*menu*background:                   white
  870. !Mwm*menu*foreground:                   black
  871. Mwm*menu*backgroundPixmap:              foreground
  872. !Mwm*menu*topShadowPixmap:              foreground
  873. !Mwm*menu*bottomShadowPixmap:           background
  874.  
  875. !Mwm*icon*background:                   white
  876. !Mwm*icon*foreground:                   black
  877. Mwm*icon*activeBackgroundPixmap:        50_foreground
  878. Mwm*icon*activeBottomShadowPixmap:      foreground
  879. Mwm*icon*backgroundPixmap:              75_foreground
  880.  
  881.  
  882.  
  883. -----------------------------------------------------------------------------
  884. Subject: 26)  How can I modify the Motif window manager decorations?
  885.  
  886. Answer: In resource files, use the window manager's client resource (which is
  887. the application) and the resource clientDecoration:
  888.  
  889. Mwm*XClock.clientDecoration:   none
  890.  
  891. turns off all clock decorations.  See the mwm(1) entry for other
  892. possibilities.
  893.  
  894. Programmatically, set the VendorShell resource XmNmwmDecorations to
  895. appropriate values: MWM_DECOR_NONE (or a bitwise or of values).
  896.  
  897. -----------------------------------------------------------------------------
  898. Subject: 27)  How can I turn off the Motif window manager functions from the
  899. system menu?
  900. [Last modified: October 92]
  901.  
  902. Answer: The user of an application can control functions in the system menu
  903. for an application using the mwm resource clientFunctions:
  904.  
  905.         mwm.application_name.clientFunctions: -resize -close
  906.  
  907. Note that mwm will have to be restarted after putting this in their resource
  908. database.
  909.  
  910.  
  911. Answer: The writer of an application can only remove items.  Be warned that
  912. your users will probably gnash their teeth, swear furiously at your product
  913. and stop using it if they discover that you have done this.  (Especially if
  914. you have removed the Close button, your application has hung and it has taken
  915. up all of memory and swap so it can't be killed.) Much better is to catch the
  916. action gracefully as in the next question.
  917.  
  918.         #include <Xm/MwmUtil.h>
  919.  
  920.         XtVaGetValues(shell, XmNmwmFunctions, &int_val, NULL);
  921.         int_val &= ~(MWM_FUNC_CLOSE | MWM_FUNC_ALL);
  922.         XtVaSetValues(shell, XmNmwmFunctions, int_val, NULL);
  923.  
  924.  
  925.  
  926. -----------------------------------------------------------------------------
  927. Subject: 28)  How can tell I if the user has selected the "Close" item on the
  928. system menu attached to the top-level shell?  I need to do some clean up
  929. before exiting.
  930.  
  931. [Last modified: May 93]
  932.  
  933. Answer:          This works with R4 Intrinsics
  934.  
  935.         #include <Xm/Protocols.h>
  936.  
  937.         void FinalCleanupCB(w, client_data, call_data)
  938.         Widget   w;
  939.         caddr_t  client_data, call_data;
  940.         {
  941.                 /* tidy up stuff here */
  942.                 ...
  943.                 /* exit if you want to */
  944.                 exit (0);
  945.         }
  946.  
  947.         main()
  948.         {
  949.                 Atom wm_delete_window;
  950.  
  951.                 ...
  952.                 XtRealizeWidget(toplevel);
  953.                 ...
  954.                 wm_delete_window =
  955.                         XmInternAtom(XtDisplay(toplevel),
  956.                                 "WM_DELETE_WINDOW", False);
  957.                 XmAddWMProtocolCallback(toplevel, wm_delete_window,
  958.                         FinalCleanupCB, NULL);
  959.                 XtMainLoop();
  960.         }
  961.  
  962. This will still kill the application.  To turn this behaviour off so that the
  963. application is not killed, set the shell resource XmNdeleteResponse to
  964. XmDO_NOTHING.  This means that users cannot kill your application via the
  965. system menu, and may be a bad thing.
  966.  
  967. If you are running R3, Bob Hays (bobhays@spss.com) has suggested this:
  968. "Trapping on the delete window atom does not work as I cannot force my action
  969. routine to the top of the action list for the activity desired, so the window
  970. manager kills my window anyway BEFORE I can do anything about it.  And, to
  971. make matters worse, the window manager (Motif in this case) tacks its atoms
  972. and handlers onto the window at some unknown point down the line after the
  973. creation of the shell widget as far as I can tell.  So....
  974.  
  975. I have a procedure as an action routine for ClientMessage.  Then, if I get a
  976. property change event on the window manager protocols, I then tack on
  977. WM_SAVE_YOURSELF.  If I get this request, I clean up (it seems to happen on
  978. WM_DELETE_WINDOW, BTW, if you remove WM_DELETE_WINDOW from the WM protocols
  979. atom) and exit.  Works great and is less filling overall:-)."
  980.  
  981.  
  982. -----------------------------------------------------------------------------
  983. Subject: 29)  Is there an mwm virtual desktop manager?
  984.  
  985. Answer: Peter E. Wagner (pew@cs.brown.edu): Imagine that your "desktop"
  986. extends beyond the view provided by your monitor.  A virtual window manager
  987. gives you access to the space beyond your viewport (i.e. your screen) by
  988. allowing you to move the viewport to other areas of the extended desktop.
  989.  
  990. The first one is Solbourne's swm, which spawned vtwm/tvtwm/olvwm.
  991.  
  992. David B. Lewis created one.  suresh@unipalm.co.uk has further developed it
  993. into the UniPalm product DOORS, which is only available as a source code
  994. extension to the MOTIF window manager.  The price of the source and unlimited
  995. right to distribute binaries is 10,000 pounds Sterling.  Alternately, source
  996. and right to use within one company is 2,000 pounds Sterling.  Contact Peter
  997. Dawe
  998.  
  999. Unipalm Limited                         Voice: +44 (0) 223 420002
  1000. 216 The Science Park                    Fax:   +44 (0) 223 426868
  1001. CAMBRIDGE
  1002. CB4 4WA
  1003.  
  1004.  
  1005.  
  1006. An enhancement request for such an object has been filed with OSF.
  1007.  
  1008. -----------------------------------------------------------------------------
  1009. Subject: 30)  Why does mwm 1.2 crash on startup?
  1010.  
  1011. [Last modified: March 93]
  1012.  
  1013. Answer: From David Brooks: The commonest cause of early mwm demise is as
  1014. follows:
  1015.  
  1016. - You, or someone, built Xlib in the default way using the Xsi
  1017.   internationalization functions.
  1018.  
  1019. - Your Xlib wasn't installed completely (or at all).
  1020.  
  1021. - Early on, mwm calls the function XmbTextListToTextProperty, which calls
  1022.   _XConvertMBToCT, which looks for the Xsi locale database, finds it
  1023.   missing, ignores this fact and tries to dereference zero.
  1024.  
  1025. The workaround is to find the database *somewhere*, and point the environment
  1026. variable XNLSPATH at it.  For example, in my personal X source tree:
  1027.  
  1028.         setenv XNLSPATH /home/X11r5src/mit/lib/nls/Xsi
  1029.  
  1030.  
  1031. -----------------------------------------------------------------------------
  1032. -----------------------------------------------------------------------------
  1033. Subject: 31)  TOPIC: MOTIF GENERATORS
  1034.  
  1035. -----------------------------------------------------------------------------
  1036. Subject: 32)  What prototyping tools are there to generate Motif code?
  1037.  
  1038. [Last modified: June 93]
  1039.  
  1040. Answer: [An FAQ is for "personal opinions" on these tools.  I don't think it
  1041. is appropriate to give such opinions through this particular posting, so I
  1042. haven't included any. I will include vendor-provided descriptions provided
  1043. they are consise and informative]
  1044.  
  1045. `Prototyping tools' come in two forms: those that can be used to design the
  1046. interface only (GUI builder), and those that go beyond this to give support
  1047. for application code (User Interface Management Systems).  There are a number
  1048. of commercial and non-commercial tools of both kinds that will support the
  1049. Motif interface.  They include:
  1050.  
  1051. GUI builders:
  1052.  
  1053. Builder Xcessory
  1054. iXBUILD (formerly X Build)
  1055. ExoCODE/xm
  1056. MOTIFATION
  1057. X-Designer
  1058. Druid
  1059.  
  1060.  
  1061. UIMS:
  1062.  
  1063. WINTERP
  1064. ALEX
  1065. TAE Plus
  1066. Widget Creation Library
  1067. UIMX
  1068. Serpent
  1069. TeleUse
  1070. XFaceMaker2
  1071. MetaCard
  1072. ezX User Interface Management System
  1073.  
  1074.  
  1075. Some contact addresses are:
  1076.  
  1077.  
  1078.  
  1079. TAE Plus: Don Link, Century Computing, Inc. (301) 953-3330 tae-facts@cen.com
  1080.  
  1081. TAE Plus is a mature, portable software development environment that supports
  1082. rapid building, tailoring, and management of Motif-based graphical user
  1083. interfaces.  The code generator can produce C, C++ and Ada code and allows for
  1084. merging regenerated code with previously modified parts of the interface.  You
  1085. an also generate a UIL/Mrm representation of your interface.  Scripting
  1086. capabilities are provided which facilitate automatic testing, on-line demos,
  1087. and tutorials.  A record and playback feature lets you build scripts simply by
  1088. interacting with your GUI.  A library of Dynamic Data Objects allows the user
  1089. to create truly graphical objects whose dynamic portions can reflect data as
  1090. well as be directly manipulated by the end-user. TAE Plus is available on
  1091. virtually all the standard X platforms and comes with a wide array of support
  1092. vehicles. (i.e., support office, newsletter, user's conference, etc.)
  1093.  
  1094. WINTERP: You may obtain the current source, documentation, and examples via
  1095. anonymous ftp from host export.lcs.mit.edu: in directory contrib/winterp you
  1096. will find the compress(1)'d tar(1) file winterp.tar.Z. If you do not have
  1097. Internet access you may request the source code to be mailed to you by sending
  1098. a message to winterp-source%hplnpm@hplabs.hp.com or hplabs!hplnpm!winterp-
  1099. source.
  1100.  
  1101. Serpent: The S/W is free (anonymous ftp) from ftp.sei.cmu.edu.  For more info
  1102. contact erik/robert at serpent-info@sei.cmu.edu.  This is no longer supported,
  1103. and is apparently replaced by a commercial product called Alpha.  TeleUSE:
  1104. Built around X Windows and OSF/Motif, TeleUSE's comprehensive toolset gives
  1105. you maximum control over every phase of graphical user interface development,
  1106. including static screen layout and design, automatic implementation of
  1107. callbacks, building the executable, and the interactive test, debug, and
  1108. maintenance cycles.
  1109.  
  1110. For more information, please contact:
  1111.  
  1112. In North America and countries not specified below:
  1113.  
  1114. Alsys (formerly TeleSoft)
  1115. 10251 Vista Sorrento Parkway Suite 300
  1116. San Diego, CA 92121 USA
  1117.  
  1118. (619) 457-2700 X244
  1119. (619) 452-1334 (fax)
  1120. leigh@alsys.com
  1121.  
  1122. In France: +33 1 47 66 21 83
  1123. In the UK: +49 491 579 090
  1124. In Scandinavia: +46 8 520 69010
  1125. In the Benelux: +31 15 62 21 21
  1126. In Germany: +49 7531 65022
  1127. In Italy: +39 6 5045 1
  1128. In Japan: +81 3 522 85620
  1129. In South Korea: +82 2 577 2044
  1130.  
  1131.  
  1132.  
  1133. Builder Xcessory from ICS.  More details are available by sending a request to
  1134. info@ics.com.  Address: ICS Inc., 201 Broadway, Cambridge MA 02139, Tel. (617)
  1135. 621-0060, Fax. (617) 621-9555
  1136.  
  1137. X-Designer: From Imperial Software Technology in the UK.  Email address is
  1138. sales@ist.co.uk.  (+44) 743 587055
  1139.  
  1140. Recently, V.I. Corporation have become the distributor for the X-Designer
  1141. product in the United States.  In addition, IST and V.I. Corporation have
  1142. developed a product called DVX-Designer that merges X-Designer with their GUI
  1143. product called DataViews.  Other merged products are in the works.  For more
  1144. information, people can contact:
  1145.  
  1146.         V.I. Corporation
  1147.         47 Pleasant Street
  1148.         Northampton, MA  01060
  1149.         Phone: (413) 586-4144
  1150.         Fax: (413) 586-3805
  1151.         Email: vi@vicorp.com
  1152.  
  1153. ExoCODE/xm: From Expert Object Corp., 7250 Cicero Avenue, Lincolnwood, IL
  1154. 60646 (708)676-5555.
  1155.  
  1156. X Build: iXOS Software GmbH, Bretonischer Ring 12,
  1157.         8011 Grasbrunn/Munich,
  1158.         Germany,
  1159.         email support@ixos.de or office@ixos.de,
  1160.         phone ++49-89-46005 0
  1161.  
  1162. or in the US
  1163.  
  1164.         UniPress Software,
  1165.         2025 Lincoln Hwy.,
  1166.         Edison, NJ 08817,
  1167.         phone 1-800-222-0550
  1168.  
  1169. ExoCode: From EXOC (Chicago, IL)
  1170.  
  1171. UIMX: Visual Edge Software Limited, 3870 Cote Vertu, St Laurent, Quebec, H4R
  1172. 1V4, Phone: (514) 332-6430, Fax:   (514) 332-5914, or: Visual Edge Software
  1173. Ltd., 101 First Street, Suite 443, Los Altos, CA 94022, Phone: (415) 948-0753,
  1174. Fax:   (415) 948-0843
  1175.  
  1176. The Widget Creation Library: The distribution is available in several ways.
  1177. The preferred approach it for you to get the compressed tar file using
  1178. anonymous ftp from:
  1179.  
  1180.     export.lcs.mit.edu    (18.30.0.238) /contrib/Wcl.1.06.tar.Z
  1181.  
  1182.  
  1183. XFaceMaker2: NSL -  Non Standard Logics S.A., 57-59, rue Lhomond, 75005  Paris
  1184. - France, Phone: +33 (1) 43.36.77.50, Fax:   +33 (1) 43.36.59.78 email:
  1185. requests@nsl.fr or requests%nsl.fr@inria.fr for information.
  1186.  
  1187. Their North American office: Non Standard Logics, Inc., 4141 State Street,
  1188. Suite B-11, Santa Barbara CA 93110, Tel: 805 964 9599, Fax: 805 964 4367
  1189.  
  1190.  
  1191. MOTIFATION: PEM GmbH, Vaihinger Strasse 49, 7000 Stuttgart 80, Germany, Tel:
  1192. +49 (0) 711 713045, Fax: +49 (0) 711 713047 Email: basien@pem-stuttgart.de.
  1193. Available for (Motif 1.2/1.1) on SunOS, Solaris 2.1, HP, Interactive, ODT 3.0,
  1194. Silicon Graphics, PCS, ...
  1195.  
  1196.  
  1197. ALEX: For more information contact Michael Karliner on (+44) 81 566 2307 or
  1198. E-mail to alex@s-strat.co.uk.  ALEX Technologies, Waterman's Yard, 32a The
  1199. Mall, Ealing, London W5, UK.
  1200.  
  1201. MetaCard: MetaCard 1.0 is supported on five popular UNIX/X11 platforms: SPARC,
  1202. Sun3, DECstation, HP-9000/300, and SCO ODT.  An HP-9000/700 port is underway
  1203. and should be available by the end of July.  [They] plan to support IBM
  1204. RS/6000, SGI Iris, and DG AViiON sometime fall '92.  For more information, or
  1205. to receive a free save-disabled but licensable copy of MetaCard, email to
  1206. info@metacard.com or call 303- 447-3936.  If you have anonymous FTP access to
  1207. the Internet, you can download the current engines, documentation, and an
  1208. unlicensed Home stack from ftp.metacard.com (128.138.213.21), directory
  1209. MetaCard.  Commercial users can get MetaCard from world.std.com
  1210. (192.74.137.5), directory pub/Metacard.  If you don't have an anonymous ftp
  1211. access, you can also download MetaCard from The World using kermit or xmodem
  1212. from the ~ftp/pub/MetaCard directory.  Sign up by calling 617-739-0202 (voice)
  1213. or via modem by dialing 617-739-9753 (7 bits even parity) and logging in as
  1214. new.
  1215.  
  1216. MetaCard 1.2 Beta 5 is now available for anonymous FTP from ftp.metacard.com
  1217. (directory MetaCard/1.2B5), and ftp.uu.net (directory vendor/MetaCard/1.2B5).
  1218.  
  1219. There is also a MetaCard mailing list.  To subscribe to the metacard-list,
  1220. send mail to listserv@grot.starconn.com with the following commands in the
  1221. body of the message:
  1222.  
  1223.       subscribe metacard-list firstname lastname
  1224.       quit
  1225.  
  1226.  
  1227. Replace "firstname lastname" with your name, not your e-mail address.
  1228.  
  1229.  
  1230.  
  1231. ezX User Interface Management System
  1232. Sunrise Software, International
  1233. 170 Enterprise Center
  1234. Middletown, RI 02840
  1235. 401-847-7868
  1236. email: support@sunrise.com
  1237.  
  1238.  
  1239.  
  1240. WKSH (Windowing Korn Shell):
  1241.  
  1242.    EXtensible Korn Shell (C language calling interface,
  1243.                           dynamic library loading, etc.)
  1244.    Motif or OpenLook API
  1245.    X Toolkit Intrinsics
  1246.    WKSH Convenience Functions
  1247.    Fast Learning and Prototyping Feature (ksh interpreter)
  1248.  
  1249.  
  1250. Contact:
  1251.    Acacia Computer,
  1252.    PO Box 4376,
  1253.    Warren, NJ 07059,
  1254.    Phone: 908 548 6955,
  1255.    Email: uunet!aca1
  1256.  
  1257. or
  1258.  
  1259. Computer Aid Inc, 1-(800)-444-WKSH
  1260.  
  1261. or
  1262.  
  1263. Consensys Corp, Europe: +(44)-734-833241 (Roger Chalke), +(44)0734-835391
  1264. (Fax), US: (416)-940-2903, (416)-940-2903 (Fax).
  1265.  
  1266.  
  1267. WKSH was developed by USL. Binaries are available through Acacia Computer for
  1268. SUNOS, Solaris, SCO ODT, Intel SVR4.0
  1269.  
  1270.  
  1271. Druid is a commercial product. It currently supports Motif1.1 and 4 unix
  1272. platforms: SPARC, HP 9000, RS6000, and SGI.
  1273.  
  1274. For further information contact: Mr. Fred Lee, Automated Systems (Pte)
  1275. Limited, 203 Henderson Road, #12-07/14, Henderson Industrial Park, Singapore
  1276. 0315.  FAX: (65)272-2029
  1277.  
  1278. Or: Dr. Gurminder Singh (gsingh@iss.nus.sg), Institute of Systems Science,
  1279. National University of Singapore
  1280.  
  1281.  
  1282.  
  1283.  
  1284. -----------------------------------------------------------------------------
  1285. Subject: 33)  TOPIC: TEXT WIDGET
  1286.  
  1287. -----------------------------------------------------------------------------
  1288. Subject: 34) What is the difference between a XmTextField widget and a single
  1289. line XmText widget?
  1290.  
  1291. Answer: Their functionality is the same, but the XmTextField is designed to
  1292. give superior performance.  thanks to Ken Lee, klee@synoptics.com
  1293.  
  1294.  
  1295. -----------------------------------------------------------------------------
  1296. Subject: 35)  Why does  pressing  <return> in a text widget do nothing?  This
  1297. happens using Motif 1.0 when I have a text widget inside a bulletin board (or
  1298. form) inside a dialog shell. (In Motif 1.1 it is fixed for both text and list
  1299. widgets.)
  1300.  
  1301. Answer: In single line mode, pressing the <return> key usually invokes the
  1302. activate() action, and in multi-line mode, the newline() action.  However,
  1303. whenever a widget is the child of a bulletin board widget which is the child
  1304. of a dialog shell, the bulletin board forces all of its children to translate
  1305. <return> to the bulletin board action Return() which is usually associated
  1306. with the default button of the dialog.  To restore the text actions of
  1307. activate() or newline(), you need to overide the Return() action of the
  1308. bulletin board.
  1309.  
  1310.  
  1311.         /* declarations */
  1312.         /* for a single line widget */
  1313.         char newTrans[] = "<Key>Return : activate()";
  1314.         /* for a multi line widget */
  1315.         char newTrans[] = "<Key>Return : newline()";
  1316.         XtTranslations transTable;
  1317.  
  1318.         /* in executable section */
  1319.  
  1320.         transTable = XtParseTranslationTable(newTrans);
  1321.  
  1322.         /* after creating but before managing text widget */
  1323.  
  1324.         XtOverrideTranslations(textWidget, transTable);
  1325.  
  1326.  
  1327. -----------------------------------------------------------------------------
  1328. Subject: 36)  When I add text to a scrolling text widget how can I get the new
  1329. text to show?
  1330.  
  1331. Answer: Use the call undocumented in Motif 1.0
  1332.  
  1333.         void XmTextShowPosition(w, position)
  1334.         Widget w;
  1335.         XmTextPosition position;
  1336.  
  1337. where the position is the number of characters from the beginning of the
  1338. buffer of the text to be displayed. If you don't know how many characters are
  1339. in the buffer, use another call undocumented in Motif 1.0
  1340.  
  1341.         position = XmTextGetLastPosition(w)
  1342.  
  1343.  
  1344. -----------------------------------------------------------------------------
  1345. Subject: 37)  Does the text widget support 16 bit character fonts?
  1346.  
  1347.  
  1348. [Last modified: November 92]
  1349.  
  1350. Answer: R5 has support for 16 bit character sets, and Motif 1.2 uses that.
  1351. Neither Motif 1.0 nor 1.1 support 16 bit sets.
  1352.  
  1353. -----------------------------------------------------------------------------
  1354. Subject: 38)  How can I stop the text widget from echoing characters typed?  I
  1355. need to turn off echo for password input.
  1356.  
  1357. Answer: Use the modifyVerifyCallback to tell when input is received. Set the
  1358. `doit' field in the XmTextVerifyCallbackStruct to False to stop the echo. In
  1359. Motif 1.0 this will cause a beep per character: Live with it, because at 1.1
  1360. you can turn it off.  Note that password hiding is inherently insecure in X -
  1361. someone may have an X grab on the keyboard and be reading all characters typed
  1362. in anyway.
  1363.  
  1364. Another solution often proposed is to set the foreground and background
  1365. colours to be the same, effectively hiding the text.  This has a major flaw:
  1366. someone may select the text (triple click the mouse to get the line), and then
  1367. paste the password into say an xterm with *different* foreground and
  1368. background colours.  This immediately shows the password.
  1369.  
  1370. -----------------------------------------------------------------------------
  1371. Subject: 39)  How can I replace characters typed with say a `*'?  I want to
  1372. replace input for password entry.
  1373.  
  1374. [Last modified: April 93]
  1375.  
  1376. Answer: In Motif 1.1 Use the modifyVerifyCallback to tell when input is
  1377. received.  Set text->ptr in the callback structure to '*'. This does not work
  1378. under 1.0 because of an oversight in which changes to this are ignored.  In
  1379. Motif 1.0, what you can do is set the doit flag to 'false' so the text is not
  1380. displayed. Then set a static boolean to True to prevent re-entrance.  Next
  1381. call XmTextReplace() to display your '*'.  then reset your re-entrance flag to
  1382. False.  XmTextReplace() will call the XmNmodifyVerify callback.  To prevent
  1383. getting into an infinite loop, you need the re-entrance flag.
  1384.  
  1385. The following program from Dan Heller illustrates this:
  1386.  
  1387. --------------
  1388. /* Written by Dan Heller.  Copyright 1991, O'Reilly && Associates.
  1389.  * This program is freely distributable without licensing fees and
  1390.  * is provided without guarantee or warranty expressed or implied.
  1391.  * This program is -not- in the public domain.  This program appears
  1392.  * in the Motif Programming Manual, O'Reilly Volume 6.
  1393.  */
  1394.  
  1395. /* passwd.c -- prompt for a passwd.  Meaning, all input looks like
  1396.  * a series of *'s.  Store the actual data typed by the user in
  1397.  * an internal variable.  Don't allow paste operations.  Handle
  1398.  * backspacing by deleting all text from insertion point to the
  1399.  * end of text.
  1400.  */
  1401. #include <Xm/Text.h>
  1402. #include <Xm/LabelG.h>
  1403. #include <Xm/RowColumn.h>
  1404. #include <ctype.h>
  1405.  
  1406. void check_passwd();
  1407. char *passwd; /* store user-typed passwd here. */
  1408.  
  1409. main(argc, argv)
  1410. int argc;
  1411. char *argv[];
  1412. {
  1413.     Widget        toplevel, text_w, rowcol;
  1414.     XtAppContext  app;
  1415.  
  1416.     toplevel = XtVaAppInitialize(&app, "Demos",
  1417.         NULL, 0, &argc, argv, NULL, NULL);
  1418.  
  1419.     rowcol = XtVaCreateWidget("rowcol",
  1420.         xmRowColumnWidgetClass, toplevel,
  1421.         XmNorientation, XmHORIZONTAL,
  1422.         NULL);
  1423.  
  1424.     XtVaCreateManagedWidget("Password:",
  1425.         xmLabelGadgetClass, rowcol, NULL);
  1426.     text_w = XtVaCreateManagedWidget("text_w",
  1427.         xmTextWidgetClass, rowcol, NULL);
  1428.  
  1429.     XtAddCallback(text_w, XmNmodifyVerifyCallback, check_passwd, NULL);
  1430.     XtAddCallback(text_w, XmNactivateCallback, check_passwd, NULL);
  1431.  
  1432.     XtManageChild(rowcol);
  1433.     XtRealizeWidget(toplevel);
  1434.     XtAppMainLoop(app);
  1435. }
  1436.  
  1437. void
  1438. check_passwd(text_w, unused, cbs)
  1439. Widget        text_w;
  1440. XtPointer     unused;
  1441. XmTextVerifyCallbackStruct *cbs;
  1442. {
  1443.     char *new;
  1444.     int len;
  1445.  
  1446.     if (cbs->reason == XmCR_ACTIVATE) {
  1447.         printf("Password: %s\n", passwd);
  1448.         return;
  1449.     }
  1450.  
  1451.     if (cbs->text->ptr == NULL) { /* backspace */
  1452.         cbs->endPos = strlen(passwd); /* delete from here to end */
  1453.         if (cbs->endPos <= 0) return; /* catch null passwd - Mark Scoville */
  1454.         passwd[cbs->startPos] = 0; /* backspace--terminate */
  1455.         return;
  1456.     }
  1457.  
  1458.     if (cbs->text->length > 1) {
  1459.         cbs->doit = False; /* don't allow "paste" operations */
  1460.         return; /* make the user *type* the password! */
  1461.     }
  1462.  
  1463.     new = XtMalloc(cbs->endPos + 2); /* new char + NULL terminator */
  1464.     if (passwd) {
  1465.         strcpy(new, passwd);
  1466.         XtFree(passwd);
  1467.     } else
  1468.         new[0] = NULL;
  1469.     passwd = new;
  1470.     strncat(passwd, cbs->text->ptr, cbs->text->length);
  1471.     passwd[cbs->endPos + cbs->text->length] = 0;
  1472.  
  1473.     for (len = 0; len < cbs->text->length; len++)
  1474.         cbs->text->ptr[len] = '*';
  1475. }
  1476.  
  1477.  
  1478. -----------------------------------------------------------------------------
  1479. Subject: 40)  How can I best add a large piece of text to a scrolled text
  1480. widget?  In some versions of Motif 1.0 even using XmTextSetString, it insists
  1481. on adding the text one line at a time, adjusting the scroll bar each time. It
  1482. looks awful and is slow.
  1483.  
  1484. Answer: If you don't have this problem, use XmTextSetString to set all of the
  1485. text in the widget.  If you do have this slowdown problem even using
  1486. XmTextSetString, unmanage the widget, add the text and then manage it again.
  1487. This may cause the window to blink, but you have to put up with that or switch
  1488. to a different version of Motif.
  1489.  
  1490. -----------------------------------------------------------------------------
  1491. Subject: 41)  How can I highlight text in the Text widget?
  1492.  
  1493. Answer: From: argv@zipcode.com (Dan Heller)
  1494.  
  1495. If you don't need font or color changes, you can do all this using a Text
  1496. widget very easily [in Motif 1.1, anyway].
  1497.  
  1498.         loop() {
  1499.             pos = offset_of_pattern_in_text_widget(pattern, text_w);
  1500.             search_len = strlen(pattern);
  1501.             XmTextSetHighlight(text_w, pos, pos+search_len,
  1502.                         XmHIGHLIGHT_SELECTED);
  1503.         }
  1504.  
  1505.  
  1506. There are two choices for highlighting: reverse video (HIGHLIGHT_SELECTED) and
  1507. underlined (HIGHLIGHT_SECONDARY_SELECTED).  Be careful that your users won't
  1508. confuse your highlights with actual selections!
  1509.  
  1510. -----------------------------------------------------------------------------
  1511. Subject: 42)  How can I select all of the text in a widget programmatically?
  1512. So that some initial text is displayed, but anything typed replaces it.
  1513.  
  1514. Answer: XmTextSetSelection(Text1, 0, XmTextGetLastPosition(Text1), event-
  1515. >xbutton.time);
  1516.  
  1517. where Text1 is the widget in question (obviously) and event is some event that
  1518. triggered this call.  You can use XtLastTimestampProcessed( display) instead
  1519. of xbutton.time if you don't happen to have an event pointer handy.
  1520.  
  1521.  
  1522.  
  1523.  
  1524. -----------------------------------------------------------------------------
  1525. Subject: 43)  How can I change colours of text in the Text widget?  I want
  1526. some of the text in one colour, some in another.
  1527.  
  1528. Answer: You can't.  Text stores an ordinary string, and points where
  1529. `highlights' of various types begin and end.  These highlights are all the
  1530. control you have over components of the text.  See the previous question.
  1531.  
  1532.  
  1533. -----------------------------------------------------------------------------
  1534. Subject: 44)  How can I change the font of text in the Text widget?  I want
  1535. some of the text in one font, some in another.
  1536.  
  1537. Answer: You can't in Text (see the previous question).  If you wanted readonly
  1538. text, you could do it by using a label instead.  Label uses XmStrings, which
  1539. can contain multiple character sets in the one string.
  1540.  
  1541. -----------------------------------------------------------------------------
  1542. Subject: 45)  Is there an emacs binding for the text widget?
  1543.  
  1544. Answer: This set is due to Kee Hinckley (nazgul@alfalfa.com):
  1545.  
  1546. *XmText.translations: #override\n\
  1547.         Ctrl <Key>b:            backward-character()\n\
  1548.         Alt <Key>b:             backward-word()\n\
  1549.         Meta <Key>b:            backward-word()\n\
  1550.         Shift Alt <Key>b:       backward-word(extend)\n\
  1551.         Shift Meta <Key>b:      backward-word(extend)\n\
  1552.         Alt <Key>[:             backward-paragraph()\n\
  1553.         Meta <Key>[:            backward-paragraph()\n\
  1554.         Shift Alt <Key>[:       backward-paragraph(extend)\n\
  1555.         Shift Meta <Key>[:      backward-paragraph(extend)\n\
  1556.         Alt <Key><:             beginning-of-file()\n\
  1557.         Meta <Key><:            beginning-of-file()\n\
  1558.         Ctrl <Key>a:            beginning-of-line()\n\
  1559.         Shift Ctrl <Key>a:      beginning-of-line(extend)\n\
  1560.         Ctrl <Key>osfInsert:    copy-clipboard()\n\
  1561.         Shift <Key>osfDelete:   cut-clipboard()\n\
  1562.         Shift <Key>osfInsert:   paste-clipboard()\n\
  1563.         Alt <Key>>:             end-of-file()\n\
  1564.         Meta <Key>>:            end-of-file()\n\
  1565.         Ctrl <Key>e:            end-of-line()\n\
  1566.         Shift Ctrl <Key>e:      end-of-line(extend)\n\
  1567.         Ctrl <Key>f:            forward-character()\n\
  1568.         Alt <Key>]:             forward-paragraph()\n\
  1569.         Meta <Key>]:            forward-paragraph()\n\
  1570.         Shift Alt <Key>]:       forward-paragraph(extend)\n\
  1571.         Shift Meta <Key>]:      forward-paragraph(extend)\n\
  1572.         Ctrl Alt <Key>f:        forward-word()\n\
  1573.         Ctrl Meta <Key>f:       forward-word()\n\
  1574.         Ctrl <Key>d:            kill-next-character()\n\
  1575.         Alt <Key>BackSpace:     kill-previous-word()\n\
  1576.         Meta <Key>BackSpace:    kill-previous-word()\n\
  1577.         Ctrl <Key>w:            key-select() kill-selection()\n\
  1578.         Ctrl <Key>y:            unkill()\n\
  1579.         Ctrl <Key>k:            kill-to-end-of-line()\n\
  1580.         Alt <Key>Delete:        kill-to-start-of-line()\n\
  1581.         Meta <Key>Delete:       kill-to-start-of-line()\n\
  1582.         Ctrl <Key>o:            newline-and-backup()\n\
  1583.         Ctrl <Key>j:            newline-and-indent()\n\
  1584.         Ctrl <Key>n:            next-line()\n\
  1585.         Ctrl <Key>osfLeft:      page-left()\n\
  1586.         Ctrl <Key>osfRight:     page-right()\n\
  1587.         Ctrl <Key>p:            previous-line()\n\
  1588.         Ctrl <Key>g:            process-cancel()\n\
  1589.         Ctrl <Key>l:            redraw-display()\n\
  1590.         Ctrl <Key>osfDown:      next-page()\n\
  1591.         Ctrl <Key>osfUp:        previous-page()\n\
  1592.         Ctrl <Key>space:        set-anchor()\n
  1593.  
  1594.  
  1595. ! If you'd like the Delete key to work like backspace instead of deleting
  1596. ! backwards, add the following definition to the lines above.
  1597. !       <Key>osfDelete: delete-previous-character()\n\
  1598.  
  1599. ! These aren't included because they could intefere with
  1600. | menu accelerators (or vice versa)
  1601. !       Alt <Key>p:             backward-paragraph()\n\
  1602. !       Meta <Key>p:            backward-paragraph()\n\
  1603. !       Shift Alt<Key>p:        backward-paragraph(extend)\n\
  1604. !       Shift Meta<Key>p:       backward-paragraph(extend)\n\
  1605. !       Alt <Key>w:             copy-clipboard()\n\
  1606. !       Meta <Key>w:            copy-clipboard()\n\
  1607. !       Ctrl Alt <Key>w:        cut-clipboard()\n\
  1608. !       Ctrl Meta <Key>w:       cut-clipboard()\n\
  1609. !       Alt <Key>y:             paste-clipboard()\n\
  1610. !       Meta <Key>y:            paste-clipboard()\n\
  1611. !       Alt <Key>f:             forward-word()\n\
  1612. !       Meta <Key>f:            forward-word()\n\
  1613. !       Alt <Key>n:             forward-paragraph()\n\
  1614. !       Meta <Key>n:            forward-paragraph()\n\
  1615. !       Shift Alt <Key>n:       forward-paragraph(extend)\n\
  1616. !       Shift Meta <Key>n:      forward-paragraph(extend)\n\
  1617. !       Shift Alt <Key>f:       forward-word(extend)\n\
  1618. !       Shift Meta <Key>f:      forward-word(extend)\n\
  1619. !       Alt <Key>d:             kill-next-word()\n\
  1620. !       Meta <Key>d:            kill-next-word()\n\
  1621. !       Alt <Key>h:             select-all()\n\
  1622. !       Meta <Key>h:            select-all()\n\
  1623.  
  1624. Similar sets of translations have been suggested by others.
  1625.  
  1626. -----------------------------------------------------------------------------
  1627. Subject: 46)  How can I use a file as the text source for a Text widget?
  1628.  
  1629. Answer: You can't do it directly like you can with the Athena Text widget.
  1630. Instead, read the text from the file into a string (all of it!) and then use
  1631. XmTextSetString.  Alternatively, read blocks of characters and add them at the
  1632. end of the text using XmTextInsertString.  The following is an excerpt from
  1633. Dan Heller's "file_browser.c":
  1634.  
  1635.     /* file_browser.c -- use a ScrolledText object to view the
  1636.      * contents of arbitrary files chosen by the user from a
  1637.      * FileSelectionDialog or from a single-line text widget.
  1638.      */
  1639.  
  1640.     ...
  1641.     struct stat statb;
  1642.  
  1643.     /* make sure the file is a regular text file and open it */
  1644.     if (stat(filename, &statb) == -1 ||
  1645.             (statb.st_mode & S_IFMT) != S_IFREG ||
  1646.             !(fp = fopen(filename, "r"))) {
  1647.         if ((statb.st_mode & S_IFMT) == S_IFREG)
  1648.             perror(filename); /* send to stderr why we can't read it */
  1649.         else
  1650.             fprintf(stderr, "%s: not a regular file0, filename);
  1651.         XtFree(filename);
  1652.         return;
  1653.     }
  1654.  
  1655.     /* put the contents of the file in the Text widget by allocating
  1656.      * enough space for the entire file, reading the file into the
  1657.      * allocated space, and using XmTextFieldSetString() to show the file.
  1658.      */
  1659.     if (!(text = XtMalloc((unsigned)(statb.st_size+1)))) {
  1660.         fprintf(stderr, "Can't alloc enough space for %s", filename);
  1661.         XtFree(filename);
  1662.         fclose(fp);
  1663.         return;
  1664.     }
  1665.  
  1666.     if (!fread(text, sizeof(char), statb.st_size+1, fp))
  1667.         fprintf(stderr, "Warning: may not have read entire file!0);
  1668.  
  1669.     text[statb.st_size] = 0; /* be sure to NULL-terminate */
  1670.  
  1671.     /* insert file contents in Text widget */
  1672.     XmTextSetString(text_w, text);
  1673.  
  1674.  
  1675.  
  1676.  
  1677. -----------------------------------------------------------------------------
  1678. Subject: 47)  How can put Text in overstrike mode instead of insert?
  1679.  
  1680. Answer: There is no direct way. This was posted by Edmond Pitt
  1681. (ejp@bohra.cpg.oz) The correct answer to the question is to put the following
  1682. in a modifyVerify callback, where 'mvcb' is the XmTextVerifyCallbackStruct,
  1683. and 'overstriking' is defined by you:
  1684.  
  1685.     if (overstriking && mvcb->text->length == 1)
  1686.     {
  1687.         _XmTextDisableRedisplay(w,FALSE);
  1688.         XtCallActionProc(w,"delete-next-character",mvcb->event,0);
  1689.         _XmTextEnableRedisplay(w);
  1690.     }
  1691.  
  1692. _XmText{Dis,En}ableRedisplay() are XmText{Dis,En}ableRedisplay() in 1.0, but
  1693. X11R3 has no XtCallActionProc() anyway. For this environment you need my 1.0.3
  1694. Text widget patches posted last year & available on request.
  1695.  
  1696.  
  1697. -----------------------------------------------------------------------------
  1698. Subject: 48)  How can I make the Delete key do a backspace?
  1699.  
  1700. Answer: Put this in your .Xdefaults
  1701.  
  1702.     *XmText.translations: #override <Key>osfDelete: delete-previous-character()
  1703.  
  1704.  
  1705. -----------------------------------------------------------------------------
  1706. Subject: 49)  TOPIC: LIST WIDGET
  1707.  
  1708. -----------------------------------------------------------------------------
  1709. Subject: 50) Should I create an XmList widget as a child of automatic
  1710. XmScrolledWindow or use the XmCreateScrolledList() convenience function?
  1711.  
  1712. Answer: With most implementations, the convenience function use internal hooks
  1713. to give somewhat better scrolling performance.  thanks to Ken Lee,
  1714. klee@synoptics.com
  1715.  
  1716. -----------------------------------------------------------------------------
  1717. Subject: 51)  How do I best put a new set of items into a list?
  1718.  
  1719. Answer: Set the new list count and list by XtSetArgs and install them by
  1720. XtSetValues.
  1721.  
  1722.     XmString list[SIZE];
  1723.     int list_size;
  1724.  
  1725.     XtSetArg (args[n], XmNitemCount, list_size); n++;
  1726.     XtSetArg (args[n], XmNitems, list); n++;
  1727.     XtSetValues (w, args, n);
  1728.  
  1729. Each time the list is reset by this the old contents are freed by the widget
  1730. and the new supplied list is copied.  Do *not* free the old list of items
  1731. yourself as this would result in the space being freed twice.  It is not
  1732. necessary to remove the items one at a time, nor to "zero" out the list first.
  1733.  
  1734. -----------------------------------------------------------------------------
  1735. Subject: 52)  Can I have strings with different fonts in a list?
  1736.  
  1737. Answer: Yes. The strings are XmStrings. Each one can be created using a
  1738. different character set using a different font.
  1739.  
  1740.  
  1741. -----------------------------------------------------------------------------
  1742. Subject: 53)  Can I get a bitmap to show in a list item like I can in a Label?
  1743. I want to place a bitmap along with some normal text in my list items.
  1744.  
  1745. Answer: No. The list contains XmStrings, and these only allow text in various
  1746. character sets. The workaround is to define your font containing the icons you
  1747. want. Then you can create a fontlist containing your icon font and the font
  1748. you want the text in, and then make your items multi-segment XmStrings where
  1749. the first segment contains the code of the icon you want with a charset that
  1750. matches the icon font in your fontlist and the second segment with a charset
  1751. matching the text font.
  1752.  
  1753.  
  1754. -----------------------------------------------------------------------------
  1755. Subject: 54)  Can I have items with different colours in a list?
  1756.  
  1757. Answer: No.  The list contains XmStrings, and these only allow text in various
  1758. character sets. Since the items are XmStrings, you can already change the font
  1759. of an item by replacing it with an item with the same text and a different
  1760. charset tag.  Adding support for color would require modification of the
  1761. internal data structure in XmList as well as modification to the drawing
  1762. routines.  A possible workaround is to use a rowcolumn of buttons which can be
  1763. individually set.  However, you would have to do all list functionality
  1764. yourself.
  1765.  
  1766.  
  1767. -----------------------------------------------------------------------------
  1768. Subject: 55)  Can I grey out an item in a list?  I want to make insensitive
  1769. items in a list so that they cannot be selected.
  1770.  
  1771. Answer:
  1772.  
  1773. From W. Scott Meeks of OSF:
  1774.  
  1775. Unfortunately, you can't do it directly since the list items aren't individual
  1776. widgets.  We've had other requests for this technology, but it didn't make the
  1777. cut for 1.2; it should be in some future release.
  1778.  
  1779. However, you can probably fake it in your application with some difficulty.
  1780. First, a list item is an XmString, so you can specify a different charset for
  1781. the item than for other items in the list and then specify a font in the
  1782. list's fontlist that matches the charset and gives you the visual you want.
  1783. The next problem is making the item unselectable.  One idea would be to have
  1784. the application keep track of the insensitive items and the items currently
  1785. selected.  Then you would set up a selection callback that when called would
  1786. check the item selected against the list of insensitive items and if the
  1787. selected item matched would deselect that item and reselect the previously
  1788. selected items.  Otherwise it would just update the application's list of
  1789. selected items.  The major drawback with this approach is that you'll get
  1790. flashing whenever the list selects an item and your application immediately
  1791. de-selects.  Unfortunately I can't think of a way around this without mucking
  1792. with the list internals.
  1793.  
  1794. Another alternative suggested is to use instead a column of say read only text
  1795. widgets which you can make insensitive.
  1796.  
  1797. -----------------------------------------------------------------------------
  1798. Subject: 56)  Can I have multi-line items in a list?
  1799. [Last modified: August 92]
  1800.  
  1801. Answer: Motif 1.0 and 1.1 both have problems with multi-line items in a list.
  1802. They should work okay in Motif 1.2.
  1803.  
  1804. -----------------------------------------------------------------------------
  1805. Subject: 57)  How can I tell the position of selected items in a list?
  1806.  
  1807. [Last modified: Oct 92]
  1808.  
  1809. Answer: From  W. Scott Meeks:
  1810.  
  1811. 1) All XmList selection callbacks get an XmListCallbackStruct which includes
  1812. the item selected and its position.  In addition, the multiple and extended
  1813. selection callbacks also get a list of the selected items.  This approach
  1814. requires that your application saves this information if you need it outside
  1815. of the immediate callback.
  1816.  
  1817. 2) At any time you can XtGetValues the XmNselectedItems and
  1818. XmNselectedItemCount resources.  The problem with this approach is that
  1819. identical items may or may not show up in multiple times in this list and the
  1820. position in the selectedItems list may not relate directly to the position in
  1821. the items list.
  1822.  
  1823. 3) You can call XmListGetSelectedPos on the list widget.  This will return a
  1824. list of the positions of all selected items.
  1825.  
  1826. -----------------------------------------------------------------------------
  1827. Subject: 58)  TOPIC: FILE SELECTION BOX WIDGET
  1828.  
  1829. -----------------------------------------------------------------------------
  1830. Subject: 59)  What is libPW.a and do I need it?  My manual says I need to link
  1831. in libPW.a to use the File Selection Box.  I can't find it on my system.
  1832.  
  1833. Answer: The libPW.a is the Programmers Workbench library which is an ATT
  1834. product not included in Berkeley based systems, hence it is not found in SunOS
  1835. or Ultrix, but is found on HP-UX (a Berkeley/ATT hybrid which chose ATT in
  1836. this case).  It contains the regex(3) routines (regcmp, regex).  Some systems
  1837. which don't have these in the libc.a need to link with -lPW.  Some systems
  1838. which have the regex(3) routines in there also have the libPW.a.  If you have
  1839. regex(3) in libc, and it works, don't link with libPW.  If you don't have
  1840. regex(3) in libc, and you don't have a libPW, then check some sites on the net
  1841. for public domain replacements (several exist), or call your vendor.
  1842.  
  1843. In most versions of Motif (see the doco), you can compile FileSB.c with
  1844. -DNO_REGEX if you don't have it.
  1845.  
  1846. -----------------------------------------------------------------------------
  1847. Subject: 60)  What are these compile errors: Undefined symbol _regcmp and
  1848. _regex?
  1849.  
  1850. Answer: You need to link in the libPW library - see previous question.
  1851.  
  1852.  
  1853. -----------------------------------------------------------------------------
  1854. Subject: 61)  What's wrong with the Motif 1.0 File Selection Box?  I can't set
  1855. the directory, change the directory or get the file mask to work.
  1856.  
  1857. Answer: The 1.0 File Selection Box is broken, and these don't work.  They
  1858. weren't fixed until Motif 1.04.  Use these later versions of 1.0 or switch to
  1859. Motif 1.1 where it changed a lot.
  1860.  
  1861. Joe Hildebrand has a work-around for some of this: Before popping up an
  1862. XmFileSelectionDialog, change to the directory you want.  When a file is
  1863. selected, check if it is a directory, so that we can change to it.  i.e.
  1864.  
  1865. static void show_file_box_CB(w, client_data, call_data)
  1866.    Widget               w;
  1867.    Widget               client_data;
  1868.    XmAnyCallbackStruct  *call_data;
  1869. {
  1870.    chdir("/users/hildjj/files");
  1871.    XtManageChild(client_data);
  1872. }
  1873.  
  1874. static void val_save(w, client_data, call_data)
  1875.    Widget       w;
  1876.    Widget       client_data;
  1877.    XmSelectionBoxCallbackStruct *call_data;
  1878. {
  1879.    struct stat buf;  /* struct stat is defined in stat.h */
  1880.    char *filename;
  1881.  
  1882.    /* get the file name from the FileSelectionBox */
  1883.    filename = SmX(call_data->value);
  1884.  
  1885.    /* get the status of the file named filename, and put it into buf */
  1886.    if (!stat(filename, &buf))
  1887.    {
  1888.       /* if it's a directory */
  1889.       /* if it's a directory */
  1890.       if(S_ISDIR(buf.st_mode))
  1891.       {
  1892.          /* change to that directory, and update the FileSelectionBox */
  1893.         chdir(filename);
  1894.         XmFileSelectionDoSearch(w, NULL);
  1895.       }
  1896.       else
  1897.          /* if it's a regular file */
  1898.          if(S_ISREG(buf.st_mode))
  1899.             /* ask if it should be overwritten */
  1900.             XtManageChild(valbox);
  1901.          else
  1902.             /* it's another kind of file.  What type, i can't think of,
  1903.                but it might happen */
  1904.             pop_up_error_box(client_data, "Error saving file");
  1905.    }
  1906.    else  /* we couldn't get the file status */
  1907.    {
  1908.       /* if it's because the file doesn't exist, we're golden */
  1909.       if (errno == ENOENT)
  1910.          save_file();
  1911.       else   /* there is some other problem getting the status.
  1912.                 e.g. bad path */
  1913.          pop_up_error_box(client_data, "Error saving file");
  1914.    }
  1915. }
  1916.  
  1917. this still doesn't implement the file masking stuff.
  1918.  
  1919.  
  1920. -----------------------------------------------------------------------------
  1921. -----------------------------------------------------------------------------
  1922. Subject: 62)  TOPIC: FORM WIDGET
  1923.  
  1924.  
  1925. -----------------------------------------------------------------------------
  1926. Subject: 63)  Why don't labels in a Form resize when the label is changed?
  1927. I've got some labels in a form. The labels don't resize whenever the label
  1928. string resource is changed. As a result, the operator has to resize the window
  1929. to see the new label contents. I am using Motif 1.1.
  1930.  
  1931. Answer: This problem may happen to any widget inside a Form widget. The
  1932. problem was that the Form will resize itself when it gets geometry requests
  1933. from its children. If its preferred size is not allowed, the Form will
  1934. disallow all geometry requests from its children. The workaround is that you
  1935. should set any ancestor of the Form to be resizable. For the shell which
  1936. contains the Form you should set the shell resource XmNallowShellResize to be
  1937. True (by default, it is set to FALSE).  There is currently an inconsistency on
  1938. how resizing is being done, and it may get fixed in Motif 1.2.
  1939.  
  1940. From db@sunbim.be (Danny Backx)
  1941.  
  1942. Basically what you have to do is set the XmNresizePolicy on the Form to
  1943. XmRESIZE_NONE.  The facts seem to be that XmRESIZE_NONE does NOT mean "do not
  1944. allow resizes".  You may also have to set XmNresizable on the form to True.
  1945.  
  1946. -----------------------------------------------------------------------------
  1947. Subject: 64)  How can I center a widget in a form?
  1948.  
  1949. Answer: One of Motif's trickier questions.  The problems are that: Form gives
  1950. no support for centering, only for edge attachments, and the widget must stay
  1951. in the center if the form or the widget is resized.  Just looking at
  1952. horizontal centering (vertical is similar) some solutions are:
  1953.  
  1954.  a.  Use the table widget instead of Form.
  1955.  
  1956.  b.  A hack free solution is from Dan Heller:
  1957.  
  1958.      /* Written by Dan Heller.  Copyright 1991, O'Reilly && Associates.
  1959.       * This program is freely distributable without licensing fees and
  1960.       * is provided without guarantee or warranty expressed or implied.
  1961.       * This program is -not- in the public domain.  This program is
  1962.       * taken from the Motif Programming Manual, O'Reilly Volume 6.
  1963.       */
  1964.  
  1965.      /* corners.c -- demonstrate widget layout management for a
  1966.       * BulletinBoard widget.  There are four widgets each labeled
  1967.       * top-left, top-right, bottom-left and bottom-right.  Their
  1968.       * positions in the bulletin board correspond to their names.
  1969.       * Only when the widget is resized does the geometry management
  1970.       * kick in and position the children in their correct locations.
  1971.       */
  1972.      #include <Xm/BulletinB.h>
  1973.      #include <Xm/PushBG.h>
  1974.  
  1975.      char *corners[] = {
  1976.          "Top-Left", "Top-Right", "Bottom-Left", "Bottom-Right",
  1977.      };
  1978.  
  1979.      static void resize();
  1980.  
  1981.      main(argc, argv)
  1982.      int argc;
  1983.      char *argv[];
  1984.      {
  1985.          Widget toplevel, bboard;
  1986.          XtAppContext app;
  1987.          XtActionsRec rec;
  1988.          int i;
  1989.  
  1990.          /* Initialize toolkit and create toplevel shell */
  1991.          toplevel = XtVaAppInitialize(&app, "Demos", NULL, 0,
  1992.              &argc, argv, NULL, NULL);
  1993.  
  1994.          /* Create your standard BulletinBoard widget */
  1995.          bboard = XtVaCreateManagedWidget("bboard",
  1996.              xmBulletinBoardWidgetClass, toplevel, NULL);
  1997.  
  1998.          /* Set up a translation table that captures "Resize" events
  1999.           * (also called ConfigureNotify or Configure events).  If the
  2000.           * event is generated, call the function resize().
  2001.           */
  2002.          rec.string = "resize";
  2003.          rec.proc = resize;
  2004.          XtAppAddActions(app, &rec, 1);
  2005.          XtOverrideTranslations(bboard,
  2006.              XtParseTranslationTable("<Configure>: resize()"));
  2007.  
  2008.          /* Create children of the dialog -- a PushButton in each corner. */
  2009.          for (i = 0; i < XtNumber(corners); i++)
  2010.              XtVaCreateManagedWidget(corners[i],
  2011.                  xmPushButtonGadgetClass, bboard, NULL);
  2012.  
  2013.          XtRealizeWidget(toplevel);
  2014.          XtAppMainLoop(app);
  2015.      }
  2016.  
  2017.      /* resize(), the routine that is automatically called by Xt upon the
  2018.       * delivery of a Configure event.  This happens whenever the widget
  2019.       * gets resized.
  2020.       */
  2021.      static void
  2022.      resize(w, event, args, num_args)
  2023.      CompositeWidget w;   /* The widget (BulletinBoard) that got resized */
  2024.      XConfigureEvent *event;  /* The event struct associated with the event */
  2025.      String args[]; /* unused */
  2026.      int *num_args; /* unused */
  2027.      {
  2028.          WidgetList children;
  2029.          int width = event->width;
  2030.          int height = event->height;
  2031.          Dimension w_width, w_height;
  2032.          short margin_w, margin_h;
  2033.  
  2034.          /* get handle to BulletinBoard's children and marginal spacing */
  2035.          XtVaGetValues(w,
  2036.              XmNchildren, &children,
  2037.              XmNmarginWidth, &margin_w,
  2038.              XmNmarginHeight, &margin_h,
  2039.              NULL);
  2040.  
  2041.          /* place the top left widget */
  2042.          XtVaSetValues(children[0],
  2043.              XmNx, margin_w,
  2044.  
  2045.              XmNy, margin_h,
  2046.              NULL);
  2047.  
  2048.          /* top right */
  2049.          XtVaGetValues(children[1], XmNwidth, &w_width, NULL);
  2050.  
  2051.          /* To Center a widget in the middle of the BulletinBoard (or Form),
  2052.           * simply call:
  2053.           *   XtVaSetValues(widget,
  2054.                XmNx,    (width - w_width)/2,
  2055.                XmNy,    (height - w_height)/2,
  2056.                NULL);
  2057.           * and return.
  2058.           */
  2059.          XtVaSetValues(children[1],
  2060.              XmNx, width - margin_w - w_width,
  2061.              XmNy, margin_h,
  2062.              NULL);
  2063.          /* bottom left */
  2064.          XtVaGetValues(children[2], XmNheight, &w_height, NULL);
  2065.          XtVaSetValues(children[2],
  2066.  
  2067.              XmNx, margin_w,
  2068.              XmNy, height - margin_h - w_height,
  2069.              NULL);
  2070.          /* bottom right */
  2071.          XtVaGetValues(children[3],
  2072.              XmNheight, &w_height,
  2073.              XmNwidth, &w_width,
  2074.              NULL);
  2075.          XtVaSetValues(children[3],
  2076.              XmNx, width - margin_w - w_width,
  2077.              XmNy, height - margin_h - w_height,
  2078.              NULL);
  2079.      }
  2080.  
  2081.  c.  No uil solution has been suggested, because of the widget size problem
  2082.  
  2083. -----------------------------------------------------------------------------
  2084. Subject: 65)  How do I line up two columns of widgets of different types?  I
  2085. have a column of say label widgets, and a column of text widgets and I want to
  2086. have them lined up horizontally. The problem is that they are of different
  2087. heights. Just putting them in a form or rowcolumn doesn't line them up
  2088. properly because the label and text widgets are of different height.
  2089.  
  2090. If you want the geometry to look like this
  2091.  
  2092.           -------------------------------------
  2093.          |          -------------------------- |
  2094.          |a label  |Some text                 ||
  2095.          |          -------------------------- |
  2096.                            ------------------- |
  2097.          |a longer label  |Some more text     ||
  2098.          |                 ------------------- |
  2099.          |                    ---------------- |
  2100.          |a very long label  |Even more text  ||
  2101.          |                    ---------------- |
  2102.           -------------------------------------
  2103.  
  2104. try
  2105.  
  2106. /* Written by Dan Heller.  Copyright 1991, O'Reilly && Associates.
  2107.  * This program is freely distributable without licensing fees and
  2108.  * is provided without guarantee or warranty expressed or implied.
  2109.  * This program is -not- in the public domain.  This program is
  2110.  * taken from the Motif Programming Manual, O'Reilly Volume 6.
  2111.  */
  2112.  
  2113. /* text_form.c -- demonstrate how attachments work in Form widgets.
  2114.  * by creating a text-entry form type application.
  2115.  */
  2116.  
  2117. #include <Xm/PushB.h>
  2118. #include <Xm/PushBG.h>
  2119. #include <Xm/LabelG.h>
  2120. #include <Xm/Text.h>
  2121. #include <Xm/Form.h>
  2122.  
  2123. char *prompts[] = {
  2124.     "Name:", "Phone:", "Address:",
  2125.     "City:", "State:", "Zip:",
  2126. };
  2127.  
  2128. main(argc, argv)
  2129. int argc;
  2130. char *argv[];
  2131. {
  2132.     Widget toplevel, mainform, subform, label, text;
  2133.     XtAppContext app;
  2134.     char buf[32];
  2135.     int i;
  2136.  
  2137.     toplevel = XtVaAppInitialize(&app, "Demos", NULL, 0,
  2138.         &argc, argv, NULL, NULL);
  2139.  
  2140.     mainform = XtVaCreateWidget("mainform",
  2141.         xmFormWidgetClass, toplevel,
  2142.         NULL);
  2143.  
  2144.     for (i = 0; i < XtNumber(prompts); i++) {
  2145.         subform = XtVaCreateWidget("subform",
  2146.             xmFormWidgetClass,   mainform,
  2147.             /* first one should be attached for form */
  2148.             XmNtopAttachment,    i? XmATTACH_WIDGET : XmATTACH_FORM,
  2149.             /* others are attached to the previous subform */
  2150.             XmNtopWidget,        subform,
  2151.             XmNleftAttachment,   XmATTACH_FORM,
  2152.             XmNrightAttachment,  XmATTACH_FORM,
  2153.             NULL);
  2154.         label = XtVaCreateManagedWidget(prompts[i],
  2155.             xmLabelGadgetClass,  subform,
  2156.             XmNtopAttachment,    XmATTACH_FORM,
  2157.             XmNbottomAttachment, XmATTACH_FORM,
  2158.             XmNleftAttachment,   XmATTACH_FORM,
  2159.             XmNalignment,        XmALIGNMENT_BEGINNING,
  2160.             NULL);
  2161.         sprintf(buf, "text_%d", i);
  2162.         text = XtVaCreateManagedWidget(buf,
  2163.             xmTextWidgetClass,   subform,
  2164.             XmNtopAttachment,    XmATTACH_FORM,
  2165.             XmNbottomAttachment, XmATTACH_FORM,
  2166.             XmNrightAttachment,  XmATTACH_FORM,
  2167.             XmNleftAttachment,   XmATTACH_WIDGET,
  2168.             XmNleftWidget,       label,
  2169.             NULL);
  2170.         XtManageChild(subform);
  2171.     }
  2172.     /* Now that all the forms are added, manage the main form */
  2173.     XtManageChild(mainform);
  2174.  
  2175.     XtRealizeWidget(toplevel);
  2176.     XtAppMainLoop(app);
  2177. }
  2178.  
  2179. If you resize horizontally it stretches the text widgets.  If you resize
  2180. vertically it leaves space under the bottom (if you don't resize, this is not
  2181. problem).
  2182.  
  2183. If you want the text widgets to be lined up on the left, as in
  2184.  
  2185.           ----------------------------------------
  2186.          |                    ------------------- |
  2187.          |          a label  |Some text          ||
  2188.          |                    ------------------- |
  2189.                               ------------------- |
  2190.          |   a longer label  |Some more text     ||
  2191.          |                    ------------------- |
  2192.          |                    ------------------- |
  2193.          |a very long label  |Even more text     ||
  2194.          |                    ------------------- |
  2195.           ----------------------------------------
  2196.  
  2197. try this
  2198.  
  2199. /* Written by Dan Heller.  Copyright 1991, O'Reilly && Associates.
  2200.  * This program is freely distributable without licensing fees and
  2201.  * is provided without guarantee or warranty expressed or implied.
  2202.  * This program is -not- in the public domain.  This program is
  2203.  * taken from the Motif Programming Manual, O'Reilly Volume 6.
  2204.  */
  2205.  
  2206. /* text_entry.c -- This demo shows how the RowColumn widget can be
  2207.  * configured to build a text entry form.  It displays a table of
  2208.  * right-justified Labels and Text widgets that extend to the right
  2209.  * edge of the Form.
  2210.  */
  2211. #include <Xm/LabelG.h>
  2212. #include <Xm/RowColumn.h>
  2213. #include <Xm/Text.h>
  2214.  
  2215. char *text_labels[] = {
  2216.     "Name:", "Phone:", "Address:", "City:", "State:", "Zip:",
  2217. };
  2218.  
  2219. main(argc, argv)
  2220. int argc;
  2221. char *argv[];
  2222. {
  2223.     Widget toplevel, rowcol;
  2224.     XtAppContext app;
  2225.     char buf[8];
  2226.     int i;
  2227.  
  2228.     toplevel = XtVaAppInitialize(&app, "Demos", NULL, 0,
  2229.         &argc, argv, NULL, NULL);
  2230.  
  2231.     rowcol = XtVaCreateWidget("rowcolumn",
  2232.         xmRowColumnWidgetClass, toplevel,
  2233.         XmNpacking,        XmPACK_COLUMN,
  2234.         XmNnumColumns,     XtNumber(text_labels),
  2235.         XmNorientation,    XmHORIZONTAL,
  2236.         XmNisAligned,      True,
  2237.         XmNentryAlignment, XmALIGNMENT_END,
  2238.         NULL);
  2239.  
  2240.     /* simply loop thru the strings creating a widget for each one */
  2241.     for (i = 0; i < XtNumber(text_labels); i++) {
  2242.         XtVaCreateManagedWidget(text_labels[i],
  2243.             xmLabelGadgetClass, rowcol,
  2244.             NULL);
  2245.         sprintf(buf, "text_%d", i);
  2246.         XtVaCreateManagedWidget(buf,
  2247.             xmTextWidgetClass, rowcol,
  2248.             NULL);
  2249.     }
  2250.  
  2251.     XtManageChild(rowcol);
  2252.     XtRealizeWidget(toplevel);
  2253.     XtAppMainLoop(app);
  2254. }
  2255.  
  2256. This makes all objects exactly the same size.  It does not resize in nice
  2257. ways.
  2258.  
  2259. If you want the text widgets lined up on the left, and the labels to be the
  2260. size of the longest string, resizing nicely both horizontally and vertically,
  2261. as in
  2262.  
  2263.          -------------------------------------
  2264.         |                    ---------------- |
  2265.         |          a label  |Some text       ||
  2266.         |                    ---------------- |
  2267.                              ---------------- |
  2268.         |   a longer label  |Some more text  ||
  2269.         |                    ---------------- |
  2270.         |                    ---------------- |
  2271.         |a very long label  |Even more text  ||
  2272.         |                    ---------------- |
  2273.          -------------------------------------
  2274.  
  2275.  
  2276.  
  2277. Answer: Do this: to get the widgets lined up horizontally, use a form but
  2278. place the widgets using XmATTACH_POSITION.  In the example, attach the top of
  2279. the first label to the form, the bottomPosition to 33 (33% of the height).
  2280. Attach the topPosition of the second label to 33 and the bottomPosition to 66.
  2281. Attach the topPosition of the third label to 66 and the bottom of the label to
  2282. the form.  Do the same with the text widgets.
  2283.  
  2284. To get the label widgets lined up vertically, use the right attachment of
  2285. XmATTACH_OPPOSITE_WIDGET: starting from the one with the longest label, attach
  2286. widgets on the right to each other. In the example, attach the 2nd label to
  2287. the third, and the first to the second.  To get the text widgets lined up,
  2288. just attach them on the left to the labels.  To get the text in the labels
  2289. aligned correctly, use XmALIGNMENT_END for the XmNalignment resource.
  2290.  
  2291.         /* geometry for label 2
  2292.         */
  2293.         n = 0;
  2294.         XtSetArg (args[n], XmNalignment, XmALIGNMENT_END); n++;
  2295.         XtSetArg (args[n], XmNleftAttachment, XmATTACH_FORM); n++;
  2296.         XtSetArg (args[n], XmNbottomAttachment, XmATTACH_FORM); n++;
  2297.         XtSetArg (args[n], XmNtopAttachment, XmATTACH_POSITION); n++;
  2298.         XtSetArg (args[n], XmNtopPosition, 66); n++;
  2299.         XtSetValues (label[2], args, n);
  2300.  
  2301.         /* geometry for label 1
  2302.         */
  2303.         n = 0;
  2304.         XtSetArg (args[n], XmNalignment, XmALIGNMENT_END); n++;
  2305.         XtSetArg (args[n], XmNbottomAttachment, XmATTACH_POSITION); n++;
  2306.         XtSetArg (args[n], XmNbottomPosition, 66); n++;
  2307.         XtSetArg (args[n], XmNtopAttachment, XmATTACH_POSITION); n++;
  2308.         XtSetArg (args[n], XmNtopPosition, 33); n++;
  2309.         XtSetArg (args[n], XmNleftAttachment, XmATTACH_FORM); n++;
  2310.         XtSetArg (args[n], XmNrightAttachment, XmATTACH_OPPOSITE_WIDGET); n++;
  2311.         XtSetArg (args[n], XmNrightWidget, label[2]); n++;
  2312.         XtSetValues (label[1], args, n);
  2313.  
  2314.         /* geometry for label 0
  2315.         */
  2316.         n = 0;
  2317.         XtSetArg (args[n], XmNalignment, XmALIGNMENT_END); n++;
  2318.         XtSetArg (args[n], XmNbottomAttachment, XmATTACH_POSITION); n++;
  2319.         XtSetArg (args[n], XmNbottomPosition, 33); n++;
  2320.         XtSetArg (args[n], XmNtopAttachment, XmATTACH_FORM); n++;
  2321.         XtSetArg (args[n], XmNleftAttachment, XmATTACH_FORM); n++;
  2322.         XtSetArg (args[n], XmNrightAttachment, XmATTACH_OPPOSITE_WIDGET); n++;
  2323.         XtSetArg (args[n], XmNrightWidget, label[1]); n++;
  2324.         XtSetValues (label[0], args, n);
  2325.  
  2326.         /* geometry for text 0
  2327.         */
  2328.         n = 0;
  2329.         XtSetArg (args[n], XmNtopAttachment, XmATTACH_FORM); n++;
  2330.         XtSetArg (args[n], XmNbottomAttachment, XmATTACH_POSITION); n++;
  2331.         XtSetArg (args[n], XmNbottomPosition, 33); n++;
  2332.         XtSetArg (args[n], XmNrightAttachment, XmATTACH_FORM); n++;
  2333.         XtSetArg (args[n], XmNleftAttachment, XmATTACH_WIDGET); n++;
  2334.         XtSetArg (args[n], XmNleftWidget, label[0]); n++;
  2335.         XtSetValues (text[0], args, n);
  2336.  
  2337.         /* geometry for text 1
  2338.         */
  2339.         XtSetArg (args[n], XmNtopAttachment, XmATTACH_POSITION); n++;
  2340.         XtSetArg (args[n], XmNtopPosition, 33); n++;
  2341.         XtSetArg (args[n], XmNbottomAttachment, XmATTACH_POSITION); n++;
  2342.         XtSetArg (args[n], XmNbottomPosition, 66); n++;
  2343.         XtSetArg (args[n], XmNrightAttachment, XmATTACH_FORM); n++;
  2344.         XtSetArg (args[n], XmNleftAttachment, XmATTACH_WIDGET); n++;
  2345.         XtSetArg (args[n], XmNleftWidget, label[1]); n++;
  2346.         XtSetValues (text[1], args, n);
  2347.  
  2348.         /* geometry for text 2
  2349.         */
  2350.         XtSetArg (args[n], XmNtopAttachment, XmATTACH_POSITION); n++;
  2351.         XtSetArg (args[n], XmNtopPosition, 66); n++;
  2352.         XtSetArg (args[n], XmNrightAttachment, XmATTACH_FORM); n++;
  2353.         XtSetArg (args[n], XmNleftAttachment, XmATTACH_WIDGET); n++;
  2354.         XtSetArg (args[n], XmNleftWidget, label[2]); n++;
  2355.         XtSetArg (args[n], XmNbottomAttachment, XmATTACH_FORM); n++;
  2356.         XtSetValues (text[2], args, n);
  2357.  
  2358.  
  2359. -----------------------------------------------------------------------------
  2360. Subject: 66)  TOPIC: PUSHBUTTON WIDGET
  2361.  
  2362. -----------------------------------------------------------------------------
  2363. Subject: 67)  Why can't I use accelerators on buttons not in a menu?
  2364.  
  2365. Answer: It is apparently a difficult feature to implement, but OSF are
  2366. considering this for the future. It is problematic trying to use the Xt
  2367. accelerators since the Motif method interferes with this.  one workaround
  2368. suggested is to duplicate your non-menu button by a button in a menu
  2369. somewhere, which does have a menu-accelerator installed.  When the user
  2370. invokes what they think is the accelerator for the button they can see Motif
  2371. actually invokes the button on the menu that they can't see at the time.
  2372. Another method is described below and was contributed by Harald Albrecht of
  2373. Institute of Geometry and Practical Mathematics Rhine Westphalia Technical
  2374. University Aachen (RWTH Aachen), Germany
  2375.  
  2376.  
  2377. From albrecht@igpm.rwth-aachen.de Thu Jul  8 11:44:21 1993
  2378.  
  2379. My work-around of this problem looks like this: (I've written that code for a
  2380. Motif Object Library in C++ so please forgive me for being object orientated!)
  2381. The hack consists of a rewritten message loop which checks for keypresses
  2382. <MAlt>+<key>. If MessageLoop() finds such a keypress HandleAcc() ist called
  2383. and the widget tree is searched for a suitable widget with the right mnemonic.
  2384.  
  2385.  
  2386. // --------------------------------------------------------------------------
  2387. // traverse the widget tree starting with the given widget.
  2388. //
  2389. BOOL TraverseWidgetTree(Widget w, char *pMnemonic, XKeyEvent *KeyEvent)
  2390. {
  2391.     Widget               wChild;
  2392.     WidgetList           ChildList;
  2393.     int                  NumChilds, Child;
  2394.     KeySym               LabelMnemonic;
  2395.     char                 *pMnemonicString;
  2396.  
  2397. // Check if the widget is a subclass of label -- then it may have an
  2398. // accelerator attached...
  2399.     if ( XtIsSubclass(w, xmLabelWidgetClass) ) {
  2400. // ok. Now: get the widget's mnemonic, convert it to ASCII and compare
  2401. // it with the Key we're looking for.
  2402.         XtVaGetValues(w, XmNmnemonic, &LabelMnemonic, NULL);
  2403.         pMnemonicString = XKeysymToString(LabelMnemonic);
  2404.         if ( pMnemonicString &&
  2405.              (strcasecmp(pMnemonicString, pMnemonic) == 0) ) {
  2406.             // stimulate the keypress
  2407.             XmProcessTraversal((Widget)w, XmTRAVERSE_CURRENT);
  2408.             KeyEvent->type      = KeyPress;
  2409.             KeyEvent->window    = XtWindow(w);
  2410.             KeyEvent->subwindow = XtWindow(w);
  2411.             KeyEvent->state     = 0;
  2412.             KeyEvent->keycode   =
  2413.                 XKeysymToKeycode(XtDisplay(w), XK_space);
  2414.             XSendEvent(XtDisplay(w), XtWindow(w),
  2415.                        True,
  2416.                        ButtonPressMask, (XEvent*) KeyEvent);
  2417.             KeyEvent->type      = KeyRelease;
  2418.             XSendEvent(XtDisplay(w), XtWindow(w),
  2419.                        True,
  2420.                        ButtonReleaseMask, (XEvent*) KeyEvent);
  2421.             return True;
  2422.         }
  2423.     }
  2424. // if this widget is a subclass of Composite check all the widget's
  2425. // childs.
  2426.     if ( XtIsSubclass(w, compositeWidgetClass) ) {
  2427. // if we're in a menu (or something like that) forget this leaf of the
  2428. // widget tree!
  2429.         if ( XtIsSubclass(w, xmRowColumnWidgetClass) ) {
  2430.             unsigned char RowColumnType;
  2431.             XtVaGetValues(w, XmNrowColumnType, &RowColumnType, NULL);
  2432.             if ( RowColumnType != XmWORK_AREA ) return False;
  2433.         }
  2434.         XtVaGetValues(w, XmNchildren, &ChildList,
  2435.                          XmNnumChildren, &NumChilds, NULL);
  2436.         for ( Child = 0; Child < NumChilds; ++Child ) {
  2437.             wChild = ChildList[Child];
  2438.             if ( TraverseWidgetTree(wChild, pMnemonic, KeyEvent) )
  2439.                 return True;
  2440.         }
  2441.     }
  2442.     return False;
  2443. } // TraverseWidgetTree
  2444. // --------------------------------------------------------------------------
  2445. // handle accelerators (keypress MAlt + key)
  2446. //
  2447. #define MAX_MAPPING 10
  2448. BOOL HandleAcc(Widget w, XEvent *event)
  2449. {
  2450.            Widget         widget, OldWidget;
  2451.     static char           keybuffer[MAX_MAPPING];
  2452.            int            CharCount;
  2453.     static XComposeStatus composeStatus;
  2454.  
  2455. // convert KeyPress to ASCII
  2456.     CharCount = XLookupString((XKeyEvent*) event,
  2457.                               keybuffer, sizeof(keybuffer),
  2458.                               NULL, &composeStatus);
  2459.     keybuffer[CharCount] = 0;
  2460. // Only one char is alright -- then search the widget tree for a widget
  2461. // with the right mnemonic
  2462.     if ( CharCount == 1 ) {
  2463.         keybuffer[0] = tolower(keybuffer[0]);
  2464.         widget = w;
  2465.         while ( (widget != NULL) &&
  2466.                 !XtIsSubclass(widget, shellWidgetClass) ) {
  2467.             OldWidget = widget; widget = XtParent(widget);
  2468.         }
  2469.         if ( !widget ) widget = OldWidget;
  2470.         return TraverseWidgetTree(widget,
  2471.                                   keybuffer, (XKeyEvent*) event);
  2472.     }
  2473.     return False; // no-one found.
  2474. } // HandleAcc
  2475. // --------------------------------------------------------------------------
  2476. // modified message loop
  2477. // loops until the Boolean pFlag points to is set to False
  2478. void MessageLoop(Boolean *pFlag)
  2479. {
  2480.     XEvent nextEvent;
  2481.  
  2482.     while ( *pFlag ) {
  2483.         if ( XtAppPending(AppContext) ) {
  2484.             XtAppNextEvent(AppContext, &nextEvent);
  2485.             if ( nextEvent.type == KeyPress ) {
  2486. // Falls es ein Tastendruck ist, bei dem auch noch die ALT-Taste
  2487. // (=Modifier 1) gedrueckt ist, koennte es ein Accelerator sein!
  2488.                 if ( nextEvent.xkey.state & Mod1Mask )
  2489.                     if ( HandleAcc(XtWindowToWidget(nextEvent.xkey.display,
  2490.                                                     nextEvent.xkey.window),
  2491.                                    &nextEvent) )
  2492.                         continue; // Mitteilung konnte ausgeliefert werden
  2493.                                   // und darf daher nicht den ueblichen
  2494.                                   // Weg gehen!
  2495.             }
  2496.             XtDispatchEvent(&nextEvent);
  2497.         }
  2498.     }
  2499. } // TApplication::MessageLoop
  2500.  
  2501.  
  2502. Harald Albrecht albrecht@igpm.rwth-aachen.de Institute of Geometry and
  2503. Practical Mathematics Rhine Westphalia Technical University Aachen (RWTH
  2504. Aachen), Germany
  2505.  
  2506.  
  2507. -----------------------------------------------------------------------------
  2508. Subject: 68)  TOPIC: LABEL WIDGET
  2509.  
  2510. -----------------------------------------------------------------------------
  2511. Subject: 69)  How can I align the text in a label (button, etc) widget?
  2512.  
  2513. Answer: The alignment for the label widget is controlled by the resource
  2514. XmNalignment, and the default centers the text. Use this resource to change it
  2515. to left or right alignment.  However, when the label (or any descendant) is in
  2516. a row column, and XmNisAligned is True (the default), the row column aligns
  2517. text using its resource XmNentryAlignment. If you want simultaneous control
  2518. over all widgets use this, but otherwise turn XmNisAligned off and do it
  2519. individually.
  2520.  
  2521.  
  2522.  
  2523. -----------------------------------------------------------------------------
  2524. Subject: 70)  Why doesn't label alignment work in a RowColumn?
  2525.  
  2526. Answer: RowColumn has a  resource XmNisAligned (default True) and and
  2527. XmNentryAlignment (default XmALIGNMENT_BEGINNING).  These control alignment of
  2528. the labelString in Labels and descendants. Set XmNisAligned to False to turn
  2529. this off.
  2530.  
  2531. -----------------------------------------------------------------------------
  2532. Subject: 71)  How can I set a multiline label?
  2533. [Last modified: September 92]
  2534.  
  2535. Answer: In .Xdefaults
  2536.  
  2537.       *XmLabel*labelString:             Here\nis\nthe\nLabel
  2538.  
  2539. This method does not seem to work in some of the older Motif 1.0 versions.
  2540.  
  2541. In code,
  2542.  
  2543.       char buf[128];
  2544.       XmString msg;
  2545.       sprintf(buf, "Here\nis\nthe\nLabel");
  2546.       msg = XmStringCreateLtoR(buf, XmSTRING_DEFAULT_CHARSET);
  2547.       XtSetArg (args[n], XmNlabelString, msg);
  2548.  
  2549. Gives a four line label, using the escape sequence \n for a newline.  However,
  2550. XmStringCreateLtoR() is obsoleted from version 1.1 on, and may disappear.
  2551. This is because it it is only in the AES as "trial-use" and has been proposed
  2552. for removal from the AES. Realistically, it will probably not be removed from
  2553. any backward compatible versions of Motif, but the potential is there.  If it
  2554. does disappear (or if you want to avoid using the non-AES compliant
  2555. XmSTRING_DEFAULT_CHARSET), try this from Jean-Philippe Martin-Flatin
  2556. <syj@ecmwf.co.uk>
  2557.  
  2558. #include <Xm/Xm.h>
  2559. #include <string.h>
  2560.  
  2561. /*-----------------------------------------------------
  2562.     Create a new XmString from a char*
  2563.  
  2564.     This function can deal with embedded 'newline' and
  2565.     is equivalent to the obsolete XmStringCreateLtoR,
  2566.     except it does not use non AES compliant charset
  2567.     XmSTRING_DEFAULT_CHARSET
  2568. ----------------------------------------------------*/
  2569. XmString xec_NewString(char *s)
  2570. {
  2571.     XmString xms1;
  2572.     XmString xms2;
  2573.     XmString line;
  2574.     XmString separator;
  2575.     char     *p;
  2576.     char     *t = XtNewString(s);   /* Make a copy for strtok not to */
  2577.                                     /* damage the original string    */
  2578.  
  2579.  
  2580.     separator = XmStringSeparatorCreate();
  2581.     p         = strtok(t,"\n");
  2582.     xms1      = XmStringCreateSimple(p);
  2583.  
  2584.     while (p = strtok(NULL,"\n"))
  2585.     {
  2586.         line = XmStringCreateSimple(p);
  2587.         xms2 = XmStringConcat(xms1,separator);
  2588.         XmStringFree(xms1);
  2589.         xms1 = XmStringConcat(xms2,line);
  2590.         XmStringFree(xms2);
  2591.         XmStringFree(line);
  2592.     }
  2593.  
  2594.     XmStringFree(separator);
  2595.     XtFree(t);
  2596.     return xms1;
  2597. }
  2598.  
  2599.  
  2600. Do not use XmStringCreateSimple() - it does not process the newline character
  2601. in the way you want.
  2602.  
  2603. In UIL, you have to explicitly create a compound string with a separator.
  2604. Here's what W. Scott Meeks suggests:
  2605.  
  2606. value nl : compound_string('', seperate=true);
  2607.  
  2608. object my_label : XmLabel
  2609. {
  2610.     arguments
  2611.     {
  2612.         XmNlabelString = 'Here' & nl & 'is' & nl & 'the' & nl & 'Label';
  2613.     };
  2614. };
  2615.  
  2616.  
  2617. -----------------------------------------------------------------------------
  2618. Subject: 72)  How can I have a vertical label?
  2619.  
  2620. Answer: Make a multiline label with one character per line, as in the last
  2621. question. There is no way to make the text rotated by 90 degrees though.
  2622.  
  2623.  
  2624. -----------------------------------------------------------------------------
  2625. Subject: 73)  How can I have a Pixmap in a Label?
  2626.  
  2627. Answer: From Bob Hays (bobhays@spss.com)
  2628.  
  2629.     Pixmap px_disarm, px_disarm_insens;
  2630.  
  2631.     Widget Label1;
  2632.     Pixel   foreground, background;
  2633.     Arg     args[4];
  2634.     Arg     arg[] = {
  2635.                 { XmNforeground, &foreground },
  2636.                 { XmNbackground, &background }
  2637.     };
  2638.  
  2639.     Label1 = XmCreateLabel ( Shell1, "Label1",
  2640.                                        (Arg *) NULL, (Cardinal) 0 );
  2641.     XtGetValues ( Label1, arg, XtNumber ( arg ) );
  2642.     px_disarm =
  2643.       XCreatePixmapFromBitmapData(display,
  2644.                                 DefaultRootWindow(display),
  2645.                                 mtn_bits, mtn_width, mtn_height,
  2646.                                 foreground,
  2647.                                 background,
  2648.                                 DefaultDepth(display,DefaultScreen(display)));
  2649.     px_disarm_insens =
  2650.       XCreatePixmapFromBitmapData(display,
  2651.                                 DefaultRootWindow(display),
  2652.                                 mtn_ins_bits, mtn_ins_width, mtn_ins_height,
  2653.                                 foreground,
  2654.                                 background,
  2655.                                 DefaultDepth(display,DefaultScreen(display)));
  2656.  
  2657.     n = 0;
  2658.     XtSetArg(args[n], XmNlabelType, XmPIXMAP);  n++;
  2659.     XtSetArg(args[n], XmNlabelPixmap, px_disarm);  n++;
  2660.     XtSetArg(args[n], XmNlabelInsensitivePixmap, px_disarm_insens ); n++;
  2661.     XtSetValues ( Label1, args, n );
  2662.     XtManageChild(Label1);
  2663.  
  2664. That will cause the foreground and background of your pixmap to be inherited
  2665. from the one that would be used by OSF/Motif when the label is displayed.  The
  2666. advantage is that this will utilize any resource values the user may have
  2667. requested without looking explicitly into the resource database.  And, you
  2668. will have a pixmap handy if the application insensitizes the label (without an
  2669. XmNlabelInsensitivePixmap your label will go empty if made insensitive).
  2670.  
  2671. [Bob's original code was for a PushButton. Just change all Label to PushButton
  2672. for them.]
  2673.  
  2674.  
  2675. -----------------------------------------------------------------------------
  2676. Subject: 74)  TOPIC: DRAWING AREA WIDGET
  2677.  
  2678. -----------------------------------------------------------------------------
  2679. Subject: 75)  How can I send an expose event to a Drawing Area widget?  (or
  2680. any other, come to that). I want to send an expose event so that it will
  2681. redraw itself.
  2682.  
  2683. Answer: Use the Xlib call
  2684.  
  2685.         XClearArea(XtDisplay(w), XtWindow(w), 0, 0, 0, 0, True)
  2686.  
  2687. This clears the widget's window and generates an expose event in doing so.
  2688. The widgets expose action will then redraw it.  This uses a round trip
  2689. request.  An alternative, without the round trip is
  2690.  
  2691. from orca!mesa!rthomson@uunet.uu.net  (Rich Thomson):
  2692.  
  2693.     Widget da;
  2694.     XmDrawingAreaCallbackStruct da_struct;
  2695.  
  2696.     da_struct.reason = XmCR_EXPOSE;
  2697.     da_struct.event = (XEvent *) NULL;
  2698.     da_struct.window = XtWindow(da);
  2699.  
  2700.     XtCallCallbacks(da, XmNexposeCallback, (XtPointer) da_struct);
  2701.  
  2702.  
  2703. -----------------------------------------------------------------------------
  2704. Subject: 76)  How can I know when a DrawingArea has been resized?  It
  2705. generates an expose event whn it is enlarged, but not when it is shrunk.
  2706.  
  2707. Answer: Use the resize callback.
  2708.  
  2709. -----------------------------------------------------------------------------
  2710. Subject: 77)  TOPIC: MENUS
  2711.  
  2712. -----------------------------------------------------------------------------
  2713. Subject: 78)  What can I put inside a menu bar?
  2714.  
  2715. Answer: You can only put cascade buttons in menu bars. No pushbuttons, toggle
  2716. buttons or gadgets are allowed. When you create a pulldown menu with parent a
  2717. menu bar, its real parent is a shell widget.
  2718.  
  2719. -----------------------------------------------------------------------------
  2720. Subject: 79)  Can I have a cascade button without a submenu in a pulldown
  2721. menu?
  2722.  
  2723. Answer: Yes you can. A cascade button has an activate callback which is called
  2724. when you click on it and it doesn't have a submenu. It can have a mnemonic,
  2725. but keyboard traversal using the arrow keys in the menu will skip over it.
  2726.  
  2727. -----------------------------------------------------------------------------
  2728. Subject: 80)  Should I have a cascade button without a submenu in a pulldown
  2729. menu?
  2730.  
  2731. Answer: No. This is forbidden by the style guide. Technically you can do it
  2732. (see previous question) but if you do it will not be Motif style compliant.
  2733. This is unlikely to change - if a "button" is important enough to be in a
  2734. pulldown menu bar with no pulldown, it should be a button elsewhere.  (Mind
  2735. you, you won't be able to put accelerators on it elsewhere though.)
  2736.  
  2737. -----------------------------------------------------------------------------
  2738. Subject: 81)  What is the best way to create popup menus?
  2739. [Last modified: August 92]
  2740.  
  2741. Susan Murdock Thompson (from OSF): In general, create a popupMenu as the child
  2742. from which you will be posting it from (ie: if you have a bulletinBoard with a
  2743. PushButton in it and want MB2 on the pushButton to post the popupMenu, create
  2744. the popupMenu as a child of the pushButton).  [This parent-child relationship
  2745. seems to make a big difference in the behavior of the popups.]  Add an event
  2746. handler to handle buttonPress events.  You'll need to check for the correct
  2747. button (what you've specified menuPost to be) before posting the menu.
  2748.  
  2749. To create a popup that can be accessible from within an entire client window,
  2750. create it as the child of the top-most widget (but not the shell) and add
  2751. event handlers for the top-most widget and children widgets.
  2752.  
  2753. ie:
  2754.  
  2755. {
  2756.   ....
  2757.  
  2758.   XtManageChild(rc=XmCreateRowColumn(Shell1, "rc", NULL, 0));
  2759.   XtManageChild(label = XmCreateLabel(rc, "label", NULL, 0));
  2760.   XtManageChild(text = XmCreateText(rc, "text", NULL, 0));
  2761.   XtManageChild(pushbutton = XmCreatePushButton(rc, "pushbutton", NULL, 0));
  2762.  
  2763.   n = 0;
  2764.   XtSetArg(args[n], XmNmenuPost, "<Btn3Down>"); n++;
  2765.   popup = XmCreatePopupMenu(rc, "popup", args, n);
  2766.  
  2767.   XtAddEventHandler(rc, ButtonPressMask, False, PostMenu3, popup);
  2768.   XtAddEventHandler(text, ButtonPressMask, False, PostMenu3, popup);
  2769.   XtAddEventHandler(label, ButtonPressMask, False, PostMenu3, popup);
  2770.   XtAddEventHandler(pushbutton, ButtonPressMask, False, PostMenu3, popup);
  2771.  
  2772.   XtManageChild(m1 = XmCreatePushButton(popup, "m1", NULL, 0));
  2773.   XtManageChild(m2 = XmCreatePushButton(popup, "m2", NULL, 0));
  2774.   XtManageChild(m3 = XmCreatePushButton(popup, "m3", NULL, 0));
  2775.  
  2776.   XtAddCallback(m1, XmNactivateCallback, SayCB, "button M1");
  2777.   XtAddCallback(m2, XmNactivateCallback, SayCB, "button M2");
  2778.   XtAddCallback(m3, XmNactivateCallback, SayCB, "button M3");
  2779.   ...
  2780. }
  2781.  
  2782. /* where PostMenu3 is ... */
  2783.  
  2784. PostMenu3 (w, popup, event)
  2785. Widget w;
  2786. Widget popup;
  2787. XButtonEvent * event;
  2788. {
  2789.   printf("menuPost = 3, button %d0, event->button);
  2790.  
  2791.   if (event->button != Button3)
  2792.     return;
  2793.   XmMenuPosition(popup, event);
  2794.   XtManageChild(popup);
  2795. }
  2796.  
  2797.  
  2798.  
  2799. -----------------------------------------------------------------------------
  2800. Subject: 82)  How do popup menus work?
  2801. [Last modified: August 92]
  2802.  
  2803. Answer:
  2804.  
  2805. When a popup menu is created as the child of a widget the menu system installs
  2806. a translation on the parent of the popup and descendants with an action which:
  2807. (1) when 3-rd button (the default for the menuPost resource) is pressed the
  2808. cursor changes and the mouse is grabbed for 5 seconds; (2) disables event
  2809. handlers on the descendants and the handlers are never called; (3) an event
  2810. handler installed on the parent works fine.
  2811.  
  2812. It is done so that the correct event handler will (in fact) be called.  There
  2813. is a grab with owner_events true.  The grab is released by a timer,  but
  2814. normally the posted menu shell puts up it's own grab.
  2815.  
  2816. If you only have widgets then you can use the subwindow field in the event to
  2817. identify the original widget.  If you have gadgets or other data that you want
  2818. to change the menu for (or use a specific menu for) then you must do a walk of
  2819. the parent's children to find the best match.
  2820.  
  2821. One thing to beware of is that even with the grab,  because the menu system
  2822. does a grab with owner events true, you must either have an event handler, or
  2823. nothing that will use the event on each widget in the hierarchy of the menu's
  2824. parent.  If a child widget has another event handler for button down, it may
  2825. swallow the event and do something else.
  2826.  
  2827.  
  2828.  
  2829. -----------------------------------------------------------------------------
  2830. Subject: 83)  Should I use translation tables or actions for popup menus?
  2831. [Last modified: August 92]
  2832.  
  2833. Answer: The original goal of popupMenus was that the user would not have to
  2834. specify an event handler to manage popupMenus; however, that did not become
  2835. reality.  Larry Rogers wrote:
  2836.  
  2837. > There appear to be two ways to manage popup menus.  I
  2838. > am curious what the correct way would be:
  2839.  
  2840. > 1.  Change the translation table of the widget with the
  2841. >    popup child to popup the menu.  Note that this does
  2842. >    not currently working for many widgets, because aug-
  2843. >    menting their translations, even for augment breaks
  2844. >    the widget.
  2845.  
  2846. > 2.  Add an event handler at creation to the widget; then
  2847. >    determine if the event that caused the event handler
  2848. >    to be called is the current button being used by the
  2849. >    menu as its activation button.
  2850.  
  2851. Susan Murdock Thompson (from OSF) replied: *Theoretically, you should be able
  2852. to do both.*  Our documentation says use event handlers.  Our tests for the
  2853. toolkit use event handlers and for UIL use translations.  (Although I tried an
  2854. event handler with a UIL test and it works).
  2855.  
  2856. -----------------------------------------------------------------------------
  2857. Subject: 84)  What are the known bugs in popup menus?
  2858. [Last modified: August 92]
  2859.  
  2860. Answer: As at Motif 1.1.4, the bugs for which an OSF PIR exists are:
  2861.  
  2862.    (3)  Menus not being sticky (ie: posted on a Btn CLICK)  [ Note:this
  2863.         problem occurs with OptionMenus as well]  (PIR 3435)
  2864.  
  2865.    (6)  Destroying a widget with an associated popupMenu results in
  2866.         "Warning: Attempt to remove non-existant passive grab"         (PIR
  2867. 2972)
  2868.  
  2869.    (7)  Current documentation insufficient regarding requirements for
  2870.         success in using PopupMenus.  (PIR 3433)
  2871.  
  2872.  
  2873. -----------------------------------------------------------------------------
  2874. Subject: 85)  Can I have multiple popup menus on the same widget?
  2875. [Last modified: August 92]
  2876.  
  2877. Answer: If you want to have several popups (activated by different mouse
  2878. buttons) on the same widget..., well, that doesn't work yet.
  2879.  
  2880. If you want to have several popups on different children... that works.  But
  2881. don't put a popup on the parent (manager) widget, or it will rule!
  2882.  
  2883.  
  2884.  
  2885. -----------------------------------------------------------------------------
  2886. Subject: 86)  TOPIC: INPUT FOCUS
  2887.  
  2888. -----------------------------------------------------------------------------
  2889. Subject: 87) How can I specify the widget that should have the keyboard focus
  2890. when my application starts up?  Answer: In Motif 1.2, use XmNinitialFocus on
  2891. the manager widget.  thanks to Ken Lee, klee@synoptics.com
  2892.  
  2893.  
  2894. -----------------------------------------------------------------------------
  2895. Subject: 88)  How can I direct the keyboard input to a particular widget?
  2896.  
  2897. Answer: In Motif 1.1 call XmProcessTraversal(target, XmTRAVERSE_CURRENT).  The
  2898. widget (and all of its ancestors) does need to be realized BEFORE you call
  2899. this. Otherwise it has no effect.  XmProcessTraversal is reported to have many
  2900. bugs, so it may not work right.  A common occurrence is that it doesn't move
  2901. to the widget, but if you call XmProcessTraversal *twice* in a row, it will.
  2902. If you can't get it to work, try this from Kee Hinckley:
  2903.  
  2904.     // This insane sequence is as follows:
  2905.     //      On manage set up a focus callback
  2906.     //      On focus callback set up a timer (and get rid of focus callback!)
  2907.     //      On timer set the focus (which only works if the parent
  2908.     //      has the focus,
  2909.     //      which is why we went through all of this garbage)
  2910.     // There may be a better way, but I haven't time to try it now.
  2911.     //
  2912.     static void focusTO(void *data, XtIntervalId *) {
  2913.         XmProcessTraversal((Widget) data, XmTRAVERSE_CURRENT);
  2914.     }
  2915.  
  2916.     static void focusCB(Widget w, XtPointer data, XtPointer) {
  2917.         XtRemoveCallback(w, XmNfocusCallback, focusCB, data);
  2918.         XtAppAddTimeOut(XtWidgetToApplicationContext(w), 0, focusTO, data);
  2919.     }
  2920.  
  2921.     void OmXSetFocus(Widget parent, Widget w) {
  2922.         XtAddCallback(parent, XmNfocusCallback, focusCB, w);
  2923.     }
  2924.  
  2925.  
  2926. In Motif 1.0 call the undocumented _XmGrabTheFocus(target).
  2927.  
  2928. Do not use the X or Xt calls such as XtSetKeyboardFocus since this bypasses
  2929. the Motif traversal layer and can cause it to get confused.  This can lead to
  2930. odd keyboard behaviour elsewhere in your application.
  2931.  
  2932. -----------------------------------------------------------------------------
  2933. Subject: 89)  How can I have a modal dialog which has to be answered before
  2934. the application can continue?
  2935. [Last modified: July 92]
  2936.  
  2937. Answer: The answer depends on whether you are using the Motif window manager
  2938. mwm or not.  Test for this by XmIsMotifWMRunning.
  2939.  
  2940. The window manager mwm knows how to control event passing to dialog widgets
  2941. declared as modal. If the dialog is set to application modal, then no
  2942. interaction with the rest of the application can occur until the dialog is
  2943. destroyed or unmanaged.
  2944.  
  2945. Use the appropriate code in the following program.  There is followup
  2946. discussion after the program.
  2947.  
  2948.  
  2949. /* Written by Dan Heller.  Copyright 1991, O'Reilly && Associates.
  2950.  * This program is freely distributable without licensing fees and
  2951.  * is provided without guarantee or warranty expressed or implied.
  2952.  * This program is -not- in the public domain.  This program is
  2953.  * taken from the Motif Programming Manual, O'Reilly Volume 6.
  2954.  */
  2955.  
  2956. /*
  2957.  * ask_user.c -- create a pushbutton that posts a dialog box
  2958.  * that asks the user a question that requires an immediate
  2959.  * response.  The function that asks the question actually
  2960.  * posts the dialog that displays the question, waits for and
  2961.  * returns the result.
  2962.  */
  2963. #include <X11/Intrinsic.h>
  2964. #include <Xm/DialogS.h>
  2965. #include <Xm/SelectioB.h>
  2966. #include <Xm/RowColumn.h>
  2967. #include <Xm/MessageB.h>
  2968. #include <Xm/PushBG.h>
  2969. #include <Xm/PushB.h>
  2970.  
  2971. XtAppContext app;
  2972.  
  2973. #define YES 1
  2974. #define NO  2
  2975.  
  2976. /* main() --create a pushbutton whose callback pops up a dialog box */
  2977. main(argc, argv)
  2978. char *argv[];
  2979. int argc;
  2980. {
  2981.     Widget parent, button, toplevel;
  2982.     XmString label;
  2983.     void pushed();
  2984.  
  2985.     toplevel = XtAppInitialize(&app, "Demos",
  2986.         NULL, 0, &argc, argv, NULL, NULL, 0);
  2987.  
  2988.     label = XmStringCreateSimple("/bin/rm *");
  2989.     button = XtVaCreateManagedWidget("button",
  2990.         xmPushButtonWidgetClass, toplevel,
  2991.         XmNlabelString,          label,
  2992.         NULL);
  2993.     XtAddCallback(button, XmNactivateCallback,
  2994.         pushed, "Remove Everything?");
  2995.     XmStringFree(label);
  2996.  
  2997.     XtRealizeWidget(toplevel);
  2998.     XtAppMainLoop(app);
  2999. }
  3000.  
  3001. /* pushed() --the callback routine for the main app's pushbutton. */
  3002. void
  3003. pushed(w, question)
  3004. Widget w;
  3005. char *question;
  3006. {
  3007.     if (AskUser(w, question) == YES)
  3008.         puts("Yes");
  3009.     else
  3010.         puts("No");
  3011. }
  3012.  
  3013. /*
  3014.  * AskUser() -- a generalized routine that asks the user a question
  3015.  * and returns the response.
  3016.  */
  3017. AskUser(parent, question)
  3018. char *question;
  3019. {
  3020.     static Widget dialog;
  3021.     XmString text, yes, no;
  3022.     static int answer;
  3023.     extern void response();
  3024.  
  3025.     answer = 0;
  3026.     if (!dialog) {
  3027.         dialog = XmCreateQuestionDialog(parent, "dialog", NULL, 0);
  3028.         yes = XmStringCreateSimple("Yes");
  3029.         no = XmStringCreateSimple("No");
  3030.         XtVaSetValues(dialog,
  3031.             XmNdialogStyle,        XmDIALOG_APPLICATION_MODAL,
  3032.             XmNokLabelString,      yes,
  3033.             XmNcancelLabelString,  no,
  3034.             NULL);
  3035.         XtSetSensitive(
  3036.             XmMessageBoxGetChild(dialog, XmDIALOG_HELP_BUTTON), False);
  3037.         XtAddCallback(dialog, XmNokCallback, response, &answer);
  3038.         XtAddCallback(dialog, XmNcancelCallback, response, &answer);
  3039.         /* if the user interacts via the system menu: */
  3040.         XtAddCallback(dialog, XmNpopdownCallback, response, &answer);
  3041.     }
  3042.     text = XmStringCreateSimple(question);
  3043.     XtVaSetValues(dialog,
  3044.         XmNmessageString,      text,
  3045.         NULL);
  3046.     XmStringFree(text);
  3047.     XtManageChild(dialog);
  3048.     XtPopup(XtParent(dialog), XtGrabNone);
  3049.  
  3050.     /* while the user hasn't provided an answer, simulate XtMainLoop.
  3051.      * The answer changes as soon as the user selects one of the
  3052.      * buttons and the callback routine changes its value.  Don't
  3053.      * break loop until XtPending() also returns False to assure
  3054.      * widget destruction.
  3055.      */
  3056.     while (answer == 0 || XtAppPending(app))
  3057.         XtAppProcessEvent(app, XtIMAll);
  3058.     return answer;
  3059. }
  3060.  
  3061. /* response() --The user made some sort of response to the
  3062.  * question posed in AskUser().  Set the answer (client_data)
  3063.  * accordingly and destroy the dialog.
  3064.  */
  3065. void
  3066. response(w, answer, reason)
  3067. Widget w;
  3068. int *answer;
  3069. XmAnyCallbackStruct *reason;
  3070. {
  3071.     switch (reason->reason) {
  3072.         case XmCR_OK:
  3073.             *answer = YES;
  3074.             break;
  3075.         case XmCR_CANCEL:
  3076.             *answer = NO;
  3077.             break;
  3078.         default:
  3079.             *answer = NO;
  3080.             return;
  3081.     }
  3082. }
  3083.  
  3084.  
  3085.  
  3086. If you aren't running a window manager that acknowledges this hint, then you
  3087. may have to grab the pointer (and keyboard) yourself to make sure the user
  3088. doesn't interact with any other widget.  Change the grab flag in XtPopup to
  3089. XtGrabExclusive, and XtRemoveGrab(XtParent(w)) to the response() function.
  3090.  
  3091.  
  3092. -----------------------------------------------------------------------------
  3093. Subject: 90)  TOPIC: MEMORY AND SPEED
  3094.  
  3095. -----------------------------------------------------------------------------
  3096. Subject: 91)  When can I free data structures passed to or retrieved from
  3097. Motif?
  3098.  
  3099. Answer:
  3100.  In most cases, especially for XmStrings and XmFontLists, Motif copies data
  3101. passed to it or retrieved from it, so it may be freed immediately.  Server-
  3102. side resources, such as pixmaps and color cells, however, are not copied, so
  3103. should not be freed.  More recent versions of Motif are better than earlier
  3104. versions and exceptions should be documented.  thanks to klee*synoptics.com
  3105. (Ken Lee)
  3106.  
  3107. -----------------------------------------------------------------------------
  3108. Subject: 92)  Why does my application grow in size?
  3109.  
  3110. Answer: Motif 1.0 has many memory leaks, particularly in XmString
  3111. manipulation.  Switch to Motif 1.1.
  3112.  
  3113. Answer: The Intrinsics have a memory leak in accelerator table management, and
  3114. Motif uses this heavily.  Avoid this by mapping/unmapping widgets rather than
  3115. creating/destroying them, or get  X11R4 fix-15/16/17.
  3116.  
  3117. Answer: The server may grow in size due to its own memory leaks.  Switch to a
  3118. later server.
  3119.  
  3120. Answer: You are responsible for garbage collection in `C'.  Some common cases
  3121. where a piece of memory becomes garbage are
  3122.  
  3123.  a.  Memory is allocated by Motif for XmStrings by the functions
  3124.      XmStringConcat, XmStringCopy, XmStringCreate, XmStringCreateLtoR,
  3125.      XmStringCreateSimple, XmStringDirectionCreate, XmStringNConcat,
  3126.      XmStringNCopy, XmStringSegmentCreate, and XmStringSeparatorCreate.  The
  3127.      values returned by these functions should be freed using XmStringFree
  3128.      when they are no longer needed.
  3129.  
  3130.  b.  Memory is allocated by Motif for ordinary character strings (of type
  3131.      String) by Motif in XmStringGetLtoR, XmStringGetNextComponent, and
  3132.      XmStringGetNextSegment. After using the string, XtFree() it. [Note that
  3133.      XmStrings and Strings are two different data types.  XmStrings are
  3134.      XmStringFree'd, Strings are XtFree'd.]
  3135.  
  3136.  c.  If you have set the label (an XmString) in a label, pushbutton, etc
  3137.      widget, free it after calling XtSetValues() or the widget creation
  3138.      routine by XmStringFree().
  3139.  
  3140.  d.  If you have set text in a text widget, the text widget makes its own
  3141.      copy.  Unless you have a use for it, there is no need to keep your own
  3142.      copy.
  3143.  
  3144.  e.  If you have set the strings in a list widget the list widget makes its
  3145.      own copy.  Unless you have a use for it, there is no need to keep your
  3146.      own copy.
  3147.  
  3148.  f.  When you get the value of a single compound string from a Widget e.g.
  3149.      XmNlabelString, XmNmessageString, ... Motif gives you a copy of its
  3150.      internal value.  You should XmStringFree this when you have finished with
  3151.      it.
  3152.  
  3153.  g.  On the other hand, when you get a value of a Table e.g. XmStringTable for
  3154.      a List, you get a *pointer* to the internal Table, and should not free
  3155.      it.
  3156.  
  3157.  h.  When you get the value of the text in a widget by XmTextGetString or from
  3158.      the resource XmNvalue, you get a copy of the text.  You should XtFree
  3159.      this when you have finished with it.
  3160.  
  3161. Answer: From Josef Nelissen: at least in Motif 1.1.4, X11R4 on a HP 720, the
  3162. XmText/XmTextFieldSetString() functions have a memory leak.  The old
  3163. value/contents of the Widget isn't freed correctly.  To work around this bug,
  3164. one should use a XmText Widget (in single-line-mode) instead of a XmTextField
  3165. Widget (the solution fails with XmTextField Widgets !) and replace any
  3166.  
  3167.        XmTextSetString(text_widget, str);
  3168.  
  3169. by
  3170.  
  3171.        XmTextReplace(text_widget, (XmTextPosition) 0,
  3172.                      XmTextGetLastPosition(text_widget), str);
  3173.  
  3174.  
  3175. -----------------------------------------------------------------------------
  3176. Subject: 93)  Why does my application take a long time to start up?
  3177.  
  3178. Answer: You are probably creating too many widgets at startup time.  Delay
  3179. creating them until needed.  If you have a large number of resources in text
  3180. files (such as in app-defaults), time may be spent reading and parsing it.
  3181.  
  3182. -----------------------------------------------------------------------------
  3183. Subject: 94)  My application is running too slowly. How can I speed it up?
  3184.  
  3185. Answer: Use the R4 rather than R3 server.  It is much faster.
  3186.  
  3187. Answer: The standard memory allocator is not well tuned to Motif, and can
  3188. degrade performance.  Use a better allocator.  e.g. with SCO Unix, link with
  3189. libmalloc.a; use the allocator from GNU emacs; use the allocator from Perl.
  3190.  
  3191. Answer: Avoid lots of widget creation and destruction.  It fragments memory
  3192. and slows everything down.  Popup/popdown, manage/unmanage instead.
  3193.  
  3194. Answer: Set mappedWhenManaged to FALSE, and then call XtMapWidget()
  3195. XtUnmapWidget() rather than managing.
  3196.  
  3197. Answer: Get more memory - your application, the server and the Operating
  3198. System may be spending a lot of time being swapped.
  3199.  
  3200. Answer: If you are doing much XmString work yourself, such as heavy use of
  3201. XmStringCompare, speed may deteriorate due to the large amount of internal
  3202. conversions and malloc'ing.  Try using XmStringByteCompare if appropriate or
  3203. ordinary Ascii strings if you can.
  3204.  
  3205.  
  3206.  
  3207. -----------------------------------------------------------------------------
  3208. Subject: 95)  Why is my application so huge?
  3209.  
  3210. Answer: The typical size of a statically linked Motif app is in the megabytes.
  3211. This is often caused by the size of libXm.a. A large part of this gets linked
  3212. in to even trivial Motif programs. You can reduce the code size by linking
  3213. against shared libraries if they are available.  Running "strip" on the
  3214. executable can often reduce size. Note that the size of the running program
  3215. should be measured by "ps", not by the code size.
  3216.  
  3217. -----------------------------------------------------------------------------
  3218. -----------------------------------------------------------------------------
  3219. Subject: 96)  TOPIC: XMSTRING
  3220.  
  3221. -----------------------------------------------------------------------------
  3222. Subject: 97)  How can I get the Ascii text out of an XmString?
  3223.  
  3224. Answer: To get the first line of text from a string created left-to-right
  3225.  
  3226.  
  3227.         char *str;
  3228.         XmString xmstr;
  3229.  
  3230.         /* stuff to create xmstr */
  3231.         ...
  3232.  
  3233.         /* set str to point to the text */
  3234.         XmStringGetLtoR(xmstr, XmSTRING_DEFAULT_CHARSET, &str);
  3235.         /* use the string */
  3236.         ...
  3237.  
  3238.         /* and reclaim space */
  3239.         XtFree(str);
  3240.  
  3241.  
  3242. -----------------------------------------------------------------------------
  3243. Subject: 98)  When can XmStrings used as resources be freed?
  3244.  
  3245. Answer: The policy OSF have been trying to enforce is that if you set an
  3246. XmString or XmStringTable resource, the application is responsible for freeing
  3247. the XmStrings used because the widget makes a copy.  If you get an XmString
  3248. resource, then the application must free the value gotten.  If you get an
  3249. XmStringTable, then the application should NOT free the value gotten.  If the
  3250. application wants to manipulate it, it should make a copy first. This policy
  3251. appears to be implemented progressively, so may be less true for Motif 1.0
  3252. than 1.1.
  3253.  
  3254. -----------------------------------------------------------------------------
  3255. Subject: 99)  Why doesn't XmStringGetNextSegment() work properly?
  3256.  
  3257. Answer: The documentation in Motif 1.0 is in error. Instead of
  3258.  
  3259.         XmStringGetnextSegment(context, ...)
  3260.         XmStringContext * context;
  3261.  
  3262. it should be
  3263.  
  3264.         XmStringGetnextSegment(context, ...)
  3265.         XmStringContext context;
  3266.  
  3267. i.e. with no indirection.
  3268.  
  3269.  
  3270. -----------------------------------------------------------------------------
  3271. Subject: 100)  Why does using XmStringDraw cause a Bad Font error?
  3272.  
  3273. [Last modified: May 93]
  3274.  
  3275. Answer: From Thomas Berlage (berlage@gmdzi.gmd.de): You could call this a bug
  3276. in Motif. You pass a GC to XmStringDraw, however, Motif wants to use the fonts
  3277. from the font list to draw the string.  Therefore it replaces the font of the
  3278. GC temporarily with some fonts of its own as specified in the font list. In
  3279. the end it tries to restore the old font of the GC. There comes the problem:
  3280.  
  3281. If a GC uses the default font, the client side GC structure does not have a
  3282. valid font id (that is the 0xffffffff you may see in the error message). Motif
  3283. tries to restore this invalid id at the end.
  3284.  
  3285. The workaround is: Before drawing with XmStringDraw, set the font id of the GC
  3286. to any valid font id, for example using
  3287.  
  3288.       XSetFont (display, gc, XLoadFont (display, "fixed"));
  3289.  
  3290.  
  3291.  
  3292.  
  3293. -----------------------------------------------------------------------------
  3294. Subject: 101)  TOPIC: DIALOGS
  3295.  
  3296. -----------------------------------------------------------------------------
  3297. Subject: 102)  How do I stop my dialog disappearing when I press the help
  3298. button?
  3299.  
  3300. Answer: Bulletin board has the resource autoUnmanage which defaults to True.
  3301. This unmanages the widget when any button child is activated - including the
  3302. help button.  Set this to False to stop it disappearing. Note that you then
  3303. have to unmanage the bulletin board yourself when any other button is
  3304. activated.
  3305.  
  3306. -----------------------------------------------------------------------------
  3307. Subject: 103)  How do I make my own dialog?  I want a dialog with my own set
  3308. of buttons that stretch and shrink like the ones in e.g. PromptDialog and its
  3309. own contents.
  3310.  
  3311. Answer: Start off with say a PromptDialog. Unmanage the buttons you don't want
  3312. or manage the Apply button if you want another. Unmanage the other bits of the
  3313. selection box you don't want. You can add another WorkArea child to the
  3314. selection box for any extra stuff you want.
  3315.  
  3316.     /* Copyright 1990, Kee Hinckley and Brian Holt Hawthorne */
  3317.     /* Permission granted for any use, provided this copyright */
  3318.     /* notice is maintained. */
  3319.  
  3320.     /* Create a dialog box */
  3321.     argcount = setArgs(&args, XmNautoUnmanage, False, NULL);
  3322.     SomeDialog = XmCreatePromptDialog(mainShell, "someDialog", args, argcount);
  3323.  
  3324.     /* Now get rid of the things we don't want */
  3325.     child = XmSelectionBoxGetChild(SomeDialog, XmDIALOG_SELECTION_LABEL);
  3326.     XtUnmanageChild(child);
  3327.     child = XmSelectionBoxGetChild(SomeDialog, XmDIALOG_TEXT);
  3328.     XtUnmanageChild(child);
  3329.  
  3330.     /* set the callbacks, and make sure the buttons we want are there */
  3331.     child = XmSelectionBoxGetChild(SomeDialog, XmDIALOG_OK_BUTTON);
  3332.     XtAddCallback(child, XmNactivateCallback, callSomeFunc, someArg);
  3333.     XtAddCallback(child, XmNactivateCallback, unManage, SomeDialog);
  3334.     XtManageChild(child);
  3335.     child = XmSelectionBoxGetChild(SomeDialog, XmDIALOG_APPLY_BUTTON);
  3336.     XtAddCallback(child, XmNactivateCallback, callSomeFunc, someOtherArg);
  3337.     XtManageChild(child);
  3338.     child = XmSelectionBoxGetChild(SomeDialog, XmDIALOG_CANCEL_BUTTON);
  3339.     XtAddCallback(child, XmNactivateCallback, dialogUnmanage, SomeDialog);
  3340.     XtManageChild(child);
  3341.  
  3342.     /* Add a new work area. This can be any manager. */
  3343.     child = XmCreateForm(SomeDialog, "someForm", NULL, 0);
  3344.     XtManageChild(child);
  3345.  
  3346.     /* and fill it up... */
  3347.     something = doYourStuff(child);
  3348.  
  3349. another Answer:
  3350.  
  3351.         I had a some people asking about my xmSmartMessageBoxWidget
  3352.  
  3353.         It's public domain, and needs Motif-1.2  and is available at
  3354.         ftp.x.org:/contrib/widget/SmartMB.tar.Z.
  3355.  
  3356.         The basic idea behind it is that it allows the programmer to
  3357.         specify the management of child widgets in 4 areas: Label, Control,
  3358.         Separator and Action.  You can have up to 1 Label, 1 Control,
  3359.         1 Separator and as many Action children as you want.  It does not
  3360.         REQUIRE any of these, and there is no unmanaging of extra widgets,
  3361.         as the programmer creates what is needed.
  3362.  
  3363.         Thanks for the smart dialog info to:         John L. Cwikla
  3364.         Wolfram Research, Inc.          cwikla@wri.com
  3365.  
  3366.  
  3367.  
  3368.  
  3369. -----------------------------------------------------------------------------
  3370. Subject: 104)  How come the title bars for my dialogs now have "_popup" or
  3371. "<-popup" concatenated onto the widget name?
  3372.  
  3373.  
  3374. Answer: Motif 1.0.3 (?) "fixed" things such that title bars without an
  3375. explicit dialogTitle setting use the widget name with "_popup" or whatever
  3376. added on.  Set the dialogTitle resource explicitly if you don't want this new
  3377. default naming scheme.
  3378.  
  3379. -----------------------------------------------------------------------------
  3380. Subject: 105)  How can I force a dialog window to display?  I manage a
  3381. "working" dialog, and do some computing, but the dialog window appears blank
  3382. until the work has finished.  How can I force it to be displayed?
  3383.  
  3384. Answer: Use this.  (David Brooks, Systems Engineering, Open Software
  3385. Foundation)
  3386.  
  3387. /*
  3388.  * This procedure will ensure that, if a dialog window is being mapped,
  3389.  * its contents become visible before returning.  It is intended to be
  3390.  * used just before a bout of computing that doesn't service the display.
  3391.  * You should still call XmUpdateDisplay() at intervals during this
  3392.  * computing if possible.
  3393.  *
  3394.  * The monitoring of window states is necessary because attempts to map
  3395.  * the dialog are redirected to the window manager (if there is one) and
  3396.  * this introduces a significant delay before the window is actually mapped
  3397.  * and exposed.  This code works under mwm, twm, uwm, and no-wm.  It
  3398.  * doesn't work (but doesn't hang) with olwm if the mainwindow is iconified.
  3399.  *
  3400.  * The argument to ForceDialog is any widget in the dialog (often it
  3401.  * will be the BulletinBoard child of a DialogShell).
  3402.  */
  3403.  
  3404. ForceDialog(w)
  3405.      Widget w;
  3406. {
  3407.   Widget diashell, topshell;
  3408.   Window diawindow, topwindow;
  3409.   Display *dpy;
  3410.   XWindowAttributes xwa;
  3411.   XEvent event;
  3412.   XtAppContext cxt;
  3413.  
  3414. /* Locate the shell we are interested in.  In a particular instance, you
  3415.  * may know these shells already.
  3416.  */
  3417.  
  3418.   for (diashell = w;
  3419.        !XtIsShell(diashell);
  3420.        diashell = XtParent(diashell))
  3421.     ;
  3422.  
  3423. /* Locate its primary window's shell (which may be the same) */
  3424.  
  3425.   for (topshell = diashell;
  3426.        !XtIsTopLevelShell(topshell);
  3427.        topshell = XtParent(topshell))
  3428.     ;
  3429.  
  3430.   if (XtIsRealized(diashell) && XtIsRealized(topshell)) {
  3431.     dpy = XtDisplay(topshell);
  3432.     diawindow = XtWindow(diashell);
  3433.     topwindow = XtWindow(topshell);
  3434.     cxt = XtWidgetToApplicationContext(diashell);
  3435.  
  3436. /* Wait for the dialog to be mapped.  It's guaranteed to become so unless... */
  3437.  
  3438.     while (XGetWindowAttributes(dpy, diawindow, &xwa),
  3439.            xwa.map_state != IsViewable) {
  3440.  
  3441. /* ...if the primary is (or becomes) unviewable or unmapped, it's
  3442.    probably iconified, and nothing will happen. */
  3443.  
  3444.       if (XGetWindowAttributes(dpy, topwindow, &xwa),
  3445.           xwa.map_state != IsViewable)
  3446.         break;
  3447.  
  3448. /* At this stage, we are guaranteed there will be an event of some kind.
  3449.    Beware; we are presumably in a callback, so this can recurse. */
  3450.  
  3451.       XtAppNextEvent(cxt, &event);
  3452.       XtDispatchEvent(&event);
  3453.     }
  3454.   }
  3455.  
  3456. /* The next XSync() will get an expose event if the dialog was unmapped. */
  3457.  
  3458.   XmUpdateDisplay(topshell);
  3459. }
  3460.  
  3461.  
  3462. -----------------------------------------------------------------------------
  3463. Subject: 106)  How can I control placement of a popup widget?  Each time a
  3464. popup is created, it is placed in or over the middle of its parent.  How can I
  3465. make it obey the XmNx and XmNy values?
  3466.  
  3467. Answer: Set the resource XmNdefaultPosition for the popup to False.  Set the
  3468. position of the popup by the resource values of XmNx and XmNy.  Do not use
  3469. XtMoveWidget, as this is for widget writers only.  Here's a demo program from
  3470. Dan Heller:
  3471.  
  3472. /* Written by Dan Heller.  Copyright 1991, O'Reilly && Associates.
  3473.  * This program is freely distributable without licensing fees and
  3474.  * is provided without guarantee or warranty expressed or implied.
  3475.  * This program is -not- in the public domain.  This program is
  3476.  * taken from the Motif Programming Manual, O'Reilly Volume 6.
  3477.  */
  3478.  
  3479. /* map_dlg.c -- Use the XmNmapCallback to automatically position
  3480.  * a dialog on the screen.  Each time the dialog is displayed, it
  3481.  * is mapped down and to the right by 200 pixels in each direction.
  3482.  */
  3483. #include <Xm/MessageB.h>
  3484. #include <Xm/PushB.h>
  3485.  
  3486. /* main() --create a pushbutton whose callback pops up a dialog box */
  3487. main(argc, argv)
  3488. char *argv[];
  3489. {
  3490.     Widget toplevel, button;
  3491.     XtAppContext app;
  3492.     void pushed();
  3493.  
  3494.     toplevel = XtVaAppInitialize(&app, "Demos",
  3495.         NULL, 0, &argc, argv, NULL, NULL);
  3496.  
  3497.     button = XtCreateManagedWidget("button", xmPushButtonWidgetClass,
  3498.         toplevel, NULL, 0);
  3499.     XtAddCallback(button, XmNactivateCallback, pushed, "Hello World");
  3500.  
  3501.     XtRealizeWidget(toplevel);
  3502.     XtAppMainLoop(app);
  3503. }
  3504.  
  3505. /* callback function for XmNmapCallback.  Position dialog in 200 pixel
  3506.  * "steps".  When the edge of the screen is hit, start over.
  3507.  */
  3508. static void
  3509. map_dialog(dialog, client_data, cbs)
  3510. Widget dialog;
  3511. XtPointer client_data;
  3512. XmAnyCallbackStruct *cbs;
  3513. {
  3514.     static Position x, y;
  3515.     Dimension w, h;
  3516.  
  3517.     XtVaGetValues(dialog, XmNwidth, &w, XmNheight, &h, NULL);
  3518.     if ((x + w) >= WidthOfScreen(XtScreen(dialog)))
  3519.         x = 0;
  3520.     if ((y + h) >= HeightOfScreen(XtScreen(dialog)))
  3521.         y = 0;
  3522.     XtVaSetValues(dialog, XmNx, x, XmNy, y, NULL);
  3523.     x += 200, y += 200;
  3524. }
  3525.  
  3526. /* pushed() --the callback routine for the main app's pushbutton.
  3527.  * Create and popup a dialog box that has callback functions for
  3528.  * the Ok, Cancel and Help buttons.
  3529.  */
  3530. void
  3531. pushed(w, message)
  3532. Widget w;
  3533. char *message; /* The client_data parameter passed by XtAddCallback */
  3534. {
  3535.     Widget dialog;
  3536.     Arg arg[3];
  3537.     XmString t = XmStringCreateSimple(message);
  3538.     extern void response();
  3539.  
  3540.     XtSetArg(arg[0], XmNautoUnmanage, False);
  3541.     XtSetArg(arg[1], XmNmessageString, t);
  3542.     XtSetArg(arg[2], XmNdefaultPosition, False);
  3543.     dialog = XmCreateMessageDialog(w, "notice", arg, 3);
  3544.     XmStringFree(t);
  3545.  
  3546.     XtAddCallback(dialog, XmNmapCallback, map_dialog, NULL);
  3547.  
  3548.     XtManageChild(dialog);
  3549.     XtPopup(XtParent(dialog), XtGrabNone);
  3550. }
  3551.  
  3552.  
  3553. -----------------------------------------------------------------------------
  3554. Subject: 107)  TOPIC: LANGUAGE BINDINGS
  3555.  
  3556. -----------------------------------------------------------------------------
  3557. Subject: 108)* Is there a C++ binding for Motif?
  3558.  
  3559. [Last modified: May 93]
  3560.  
  3561.  
  3562. Answer: WWL is a library which defines C++ classes around X Toolkit Widgets.
  3563. It is intended to simplify the task of C++ code writers when using the Toolkit
  3564. by providing them with C++ objects, methods, type checking and several utility
  3565. functions and classes.
  3566.  
  3567. WWL has been tested under SunOs4.0.3 on sun3 and sun4, HPUX version 6.5 and
  3568. 7.0 and Ultrix 4.0 on DECstation 3100 and 5000. It is expected to work on most
  3569. other UNIX systems without too many problems.
  3570.  
  3571. WWL is distributed as a tar file with all the source, documentation and
  3572. example. The file is available using anonymous ftp from
  3573.  
  3574.         export.lcs.mit.edu (18.30.0.238   contrib/WWL-1.0.tar.Z
  3575.         lri.lri.fr (129.175.15.1)      pub/WWL-1.0.tar.Z
  3576.  
  3577.  
  3578. Answer: Rogue Wave Software has a C++ binding for Motif called View.h++.
  3579.  
  3580. "View.h++ is a complete C++ interface to OSF/Motif.  It doesn't just
  3581. encapsulate it, but also includes a set of classes that provide a level of
  3582. abstraction above Motif, thus simplifying menu and dialog creation, XmStrings,
  3583. XmFontLists, etc.  View.h++ supports a Model- View-Controller architecture,
  3584. allowing for an even more object-oriented interface design.  Includes a copy
  3585. of Rogue Wave's Tools.h++ (foundation class library)"
  3586.  
  3587. An object license is $795 "per seat" and a source code license is available
  3588. for $2,995 "per seat."  Rogue Wave also offers full support for View.h++.
  3589.  
  3590. It is currently available for Sun Sparc, IBM RS/6000, HP 9000/700 series, SCO,
  3591. Intel SVR4 ESIX.  Please call for Silicon Graphics and DEC Ultrix status.
  3592.  
  3593. For additional information, please contact:
  3594.  
  3595. Matt Steinauer
  3596. Rogue Wave Software, Inc.
  3597. P.O. Box 2328
  3598. Corvallis, OR 97339
  3599. Phone: (503)754-3010
  3600. Fax:   (503)757-6650
  3601.  
  3602. email:   matts@roguewave.com
  3603.  
  3604.  
  3605. Answer: Builder Xcessory 3.0, an interface builder from ICS, allows the user
  3606. to visually build C++ classes from Motif and user-written widgets.  C++ code
  3607. is generated in the "Doug Young" fashion.  (Doug actually worked on this
  3608. project with ICS.)  C and UIL can also be generated.
  3609.  
  3610. Integrated Computer Solutions, Inc. (ICS) 201 Broadway, Cambridge, MA  02139
  3611. USA info@ics.com   617/621-0060
  3612.  
  3613.  
  3614.  
  3615. Answer: From Andreas.Baecker@gmd.de: The GINA++ application framework contains
  3616. an encapsulation of the OSF/Motif widg et classes and the Xt functionality
  3617. into C++ classes. Its functionality is comparab le to that of the ULowell
  3618. binding and the WWL. Additionally, it provides an easy-to -use framework for
  3619. modeling new composite and primitive widget classes, plus an application
  3620. framework similar to ET++ or MacApp build on top of it. The binding may be
  3621. used independently from the framework classes. GINA++ is available through
  3622. anonymous ftp from ftp.gmd.de [129.26.8.90] in the directory /gmd/ginaplus.
  3623. Documentation about the Motif binding has been published in the X Resource
  3624. Journ al, Number 2, 1992, Pages 106-130. The binding compiles with AT&T C++
  3625. 2.1 and GNU G+ + 2.1 and has been tested on SunOS 4.1.[12], X11R4 and Motif
  3626. 1.1.3.
  3627.  
  3628. Answer: Motif++ is a library that defines C++ class "wrappers" for the widgets
  3629. defined in the X11R5 OSF/Motif-1.2 widget library.  It also supports
  3630. X11R4/Motif-1.1 as well.
  3631.  
  3632. Motif++ is also an application toolkit that provides other tools in
  3633. conjunction with the widget wrapper classes.  It has support for the Xbae
  3634. widget set, plus other widgets.  It has Imake support, and lots of test files.
  3635. Motif++ also has alot of contributed software.
  3636.  
  3637.  
  3638. Motif++ is very similar to other public domain widget libraries such as The
  3639. Widget Wrapper Library (WWL) and the C++ Binding for OSF/Motif developed at
  3640. the University of Lowell. The two latter libraries are the result of much
  3641. larger efforts.
  3642.  
  3643. Availability:
  3644.  
  3645. Anonymous ftp at decuac.dec.com (192.5.214.1), directory /pub/X11,
  3646. file motif++.28.jul.93.tar.Z
  3647.  
  3648. For more information, contact Ronald van Loon (rvloon@motif.hacktic.nl).
  3649. There is also mailing list for Motif++. Send e-mail to
  3650.  
  3651. Answer: Xm++ is a user interface framework for the C++ language built upon X11
  3652. and the X-Toolkit. It is designed to be a simple and intuitive programming
  3653. interface to access the functionality of commonly used widgets.  Xm++ was
  3654. initially created for the Motif widget set, now support for the Athena widgets
  3655. was added. Applications created with Xm++ run in both environments without
  3656. changes, although many nice features are only available when using Motif.
  3657.  
  3658. Xm++ is available on: export.lcs.mit.edu as: /contrib/Xm++.0.5.tar.Z
  3659.  
  3660. Answer: The Solbourne OI toolkit (not Motif) also has a C++ binding.
  3661.  
  3662. Answer: Liant have C++/Views.
  3663.  
  3664. Answer: Quest have ObjectViews.  Answer: Builder Xcessory 3.0, an interface
  3665. builder from ICS, allows the user to visually build C++ classes from Motif and
  3666. user-written widgets.  C++ code is generated in the "Doug Young" fashion.
  3667. (Doug actually worked on this project with ICS.)  C and UIL can also be
  3668. generated.
  3669.  
  3670. Integrated Computer Solutions, Inc. (ICS) 201 Broadway, Cambridge, MA  02139
  3671. USA info@ics.com   617/621-0060
  3672.  
  3673.  
  3674. Answer: Doug Young has written a book "Object Oriented Programming with C++
  3675. and Motif", Prentice-Hall ISBN 0-13-630252-1 about using C++ without requiring
  3676. one of these toolkits.
  3677.  
  3678. Answer: Unfortunately, this library (last released in 9/92) has the same name
  3679. as the one by Ronald van Loon (rvloon@motif.hacktic.nl).
  3680.  
  3681. Motif++1.2 is a library that defines C++ class "wrappers" for the widgets
  3682. defined in the OSF/Motif-1.1 widget library.  Motif++1.2 is also an
  3683. application toolkit that provides other tools in conjunction with the widget
  3684. wrapper classes.
  3685.     One enhancement of Motif++1.2 beyond its wrapper classes are the addition
  3686. of an "application" class which takes care of the low-level tasks including
  3687. initializing X, creating and managing one or more top-level shells, and
  3688. entering the main event loop.
  3689.     Another feature of Motif++1.2 is its integration with The Widget Creation
  3690. Library (Wcl).  Motif++1.2 makes it easy to initialize Wcl and create C++
  3691. wrappers for desired widgets in the widget tree.
  3692.     Availability: anonymous FTP at ftp.arc.umn.edu (137.66.130.11), file
  3693. pub/Motif++1.2.tar.Z.  Contact Paul Felix, felix@ahpcrc.umn.edu or
  3694. pfelix@vx.cis.umn.edu.
  3695.  
  3696. submitted by: mvc!biggers@duke.cs.duke.edu ( Mark R. Biggers )
  3697.  
  3698. -----------------------------------------------------------------------------
  3699. Subject: 109)  How can I have a C++ member function in a callback?
  3700.  
  3701. [Last modified: October 93]
  3702. Answer: There are three common user problems with C++ callbacks.  First, make
  3703. sure you use the correct function prototype for the function declarations.
  3704. Second, the callback function must be declared as a static member of the
  3705. class.  Third, when registering it with XtAddCallback(), you must use its full
  3706. signature.  For example: (Ken Lee klee@synoptics.com)
  3707.  
  3708.     class MyClass {
  3709.         ...
  3710.         void createWidgets();
  3711.         static void myButtonCB(Widget, XtPointer, XtPointer);
  3712.         ...
  3713.     };
  3714.     void MyClass::createWidgets() {
  3715.         ...
  3716.         w = XtCreatePushButton(...);
  3717.         XtAddCallback(w, XmNactivateCallback, &MyClass::myButtonCB,
  3718.             (XtPointer) this);
  3719.         ...
  3720.     }
  3721.     void myButtonCB(Widget w, XtPointer clientData, XtPointer callData) {
  3722.         MyClass *myclass = (MyClass *) clientData;
  3723.         ...
  3724.     }
  3725.  
  3726. Note that the "this" pointer is used as the client data.  This technique is
  3727. popular, but not required.
  3728.  
  3729.  
  3730. Motif++ has a nice tutorial summarising mechanisms (this is available
  3731. separately by email from Ronald van Loon (rvloon@motif.hacktic.nl)). Doug
  3732. Young's book deals extensively with one of these. The problem is that you
  3733. don't get the object when you just use the function as a callback.  You need
  3734. to pass the object as a pointer through as the client_data.  (use "this" as
  3735. the client_data.) Then you can retrieve the object's address, and dereference
  3736. from there. For example (Leo O'Donnell, Email: leo@avs.com),
  3737.  
  3738.     class MyButton {
  3739.       public:
  3740.                 MyButton (Widget parent, const char *name) {
  3741.                     _button = XtVaCreateManagedWidget (
  3742.                         name, xmPushButtonWidgetClass, parent, NULL, 0);
  3743.                     XtAddCallback (
  3744.                         _button,
  3745.                         XmNactivateCallback,
  3746.                         &MyButton::activateCB,
  3747.                         (XtPointer) this);
  3748.                 }
  3749.                 ~MyButton () { XtDestroyWidget (_button); }
  3750.       private:
  3751.         Widget  _button;
  3752.         static  void activateCB (Widget, XtPointer, XtPointer);
  3753.     };
  3754.  
  3755.     void MyButton::activateCB (Widget, XtPointer thisBtn, XtPointer)
  3756.     {
  3757.         MyButton *btn = (MyButton *) thisBtn;
  3758.  
  3759.         // OK you've got the button instance now. Do some stuff with it!
  3760.     }
  3761.  
  3762.  
  3763.  
  3764. -----------------------------------------------------------------------------
  3765. Subject: 110)  Is there a Common Lisp binding for Motif?
  3766.  
  3767. [Last modified: November 92]
  3768.  
  3769. Answer: Try CLM. This includes a toolkit demon (in C) that takes a widget
  3770. description (with callbacks), and forks a new process for each Motif
  3771. application (which can be just a single menu, or whatever).  Lisp can then
  3772. continue running, with a separate lightweight lisp process handling the
  3773. connection & callbacks.  In North America & net environs, CLM-2.0beta is
  3774. available from export.lcs.mit.edu.
  3775.  
  3776. There is also CLIM, the Common Lisp Interface Manager. It provides access to
  3777. motif and other toolkits and window systems.  Here is some blurb: "Version 2.0
  3778. of the Common Lisp Interface Manager (CLIM) provides access to Motif. CLIM is
  3779. the emerging standard for GUI development in Common Lisp.  It offers a set of
  3780. high-level facilities that enable rapid construction of user interfaces.
  3781. Applications written using CLIM are portable across a variety of window
  3782. systems and toolkits.  For example, on the X window System, both Motif
  3783. (OSF/Motif) and Openlook (OLIT) are supported.  CLIM accesses the toolkit
  3784. directly rather than emulating the look and feel."
  3785.  
  3786. CLIM is available from a variety of Common Lisp vendors including Symbolics
  3787. and Franz Inc. (info@franz.com).
  3788.  
  3789.  
  3790. -----------------------------------------------------------------------------
  3791. Subject: 111)* Is there an Ada binding for Motif?
  3792.  
  3793. [Last modified: Apr 94 ]
  3794.  
  3795. Answer:
  3796.  
  3797. Answer:  Integrated Computer Solutions, Inc. (ICS) supplies Ada bindings to
  3798. Motif for a number of platforms and Ada compilers.  ICS also provides Builder
  3799. Xcessory, a Motif interface builder, which outputs Ada code usable with the
  3800. Ada bindings.  The product family is known collectively as the Ada Xcessories.
  3801.  
  3802. Integrated Computer Solutions, Inc. (ICS) 201 Broadway, Cambridge, MA  02139
  3803. USA info@ics.com   617/621-0060
  3804.  
  3805.  
  3806.  
  3807. Information on Ada bindings to Motif and other services (such as SQL and
  3808. POSIX) can be found in a document maintained by the Ada Information
  3809. Clearinghouse.  The report can be found at
  3810.  
  3811.         host:   ajpo.sei.cmu.edu
  3812.         loc:    /public/ada-info/bindings.hlp.*
  3813.         access: anonymous ftp
  3814.  
  3815. The suffix to the file (indicated above with an asterix) is the date of the
  3816. latest update to the document.  For example, the full name of the report
  3817. updated on 14 June 1993 would be
  3818.  
  3819.         /public/ada-info/bindings.hlp.14Jun93.
  3820.  
  3821. The file is ASCII.
  3822.  
  3823. ------ Included File
  3824.  
  3825.  
  3826. [...Excerpted from the AdaIC report bindings.hlp.14Jun93...]
  3827. [...Updates can be found on ajpo.sei.cmu.edu, in the    ...]
  3828. [...file /public/ada-info/bindings.hlp.*  The suffix    ...]
  3829. [...is always the date of the lastest version to the    ...]
  3830. [...report.                                             ...]
  3831.  
  3832.                                      SECTION 12
  3833.                                   X-Window System:
  3834.                                OSF Motif and Open Look
  3835.                                Available Ada Bindings
  3836.  
  3837.  
  3838. 12.1  Description and Standardization Efforts
  3839.  
  3840. The X-Window System is a network-transparent window system.  It supports one
  3841. or more screens containing overlapping windows or subwindows.  X display
  3842. servers distribute user input to and accept output requests from various
  3843. client programs located either on the same machine or elsewhere in the
  3844. network.
  3845.  
  3846.             OSF Motif (Open Software Foundation/Motif) is a graphical user
  3847.             interface from OSF that provides a Presentation Manager look and
  3848.             feel for applications running on any system with X Window version
  3849.             11.  It conforms to POSIX, ANSI C and X/Open's XPG3 standards.
  3850.  
  3851. 12.2  Resources Available from Software Reuse Libraries/Repositories
  3852.  
  3853.  
  3854. ASSET                                                      (Updated:  November
  3855. 1 992)
  3856.  
  3857. The following information was taken in its entirety from the ASSET Library
  3858. Repository Catalog, October 9, 1992.  For more information on ASSET, see
  3859. Appendix C.
  3860.  
  3861.  
  3862. INTERFACE TO THE X WINDOW SYSTEM
  3863.  
  3864. VERSION_NUMBER    : 1.1
  3865. DEVELOPED_BY      : SAIC
  3866. RELEASE_DATE      : 29-SEP-88
  3867. UNIQUE_IDENTIFIER : ASSET_A_240
  3868. ALTERNATE_NAME    : SAICX2
  3869. ASSET_TYPE        : SOFTWARE CODE
  3870. FUNCTIONS         : INTERFACE, BIND
  3871. OBJECTS           : ADA, X WINDOWS
  3872. KEYWORDS          : STANDARDS, BINDINGS
  3873. COLLECTION        : STARS FOUNDATIONS
  3874. DISTRIBUTION      : UNLIMITED
  3875.  
  3876. DESCRIPTION       :
  3877.  
  3878. Interface to the X Window System
  3879.       An expression of the various concepts in Ada that provides a full,
  3880. working Ada specification of the X Window system.
  3881.      Approved for public release; distribution is unlimited.
  3882.  
  3883. 12.3  Products Available from Vendors
  3884.  
  3885.  
  3886. Advanced Technology Center                                 (Updated:  November
  3887. 1 992)
  3888.  
  3889. The Advanced Technology Center (ATC) has an Ada binding to OSF Motif for their
  3890. AXI~ product.  AXI is currently available for most UNIX-based platforms, and
  3891. is supported by Verdix, Meridian, and TeleSoft compilers.
  3892.  
  3893. AXI is an Ada-to-X-Window System interface that provides the Ada programmer
  3894. access to the 500+ functions, libraries, and procedures contained in the X
  3895. library (Xlib), the X Toolkit (Xt), the X Extensible Library, the X
  3896. Miscellaneous Utilities, the Motif widget set and the Motif Resource Manager.
  3897.  
  3898. ATC is planning to develop an Ada binding to Open Look for AXI.
  3899.  
  3900. For more information, contact:Larry Paulson, Advanced Technology Center, 22982
  3901.                         Mill Creek Drive, Laguna Hills, CA  92653, USA; Phone:
  3902.                         714-583-9119
  3903.  
  3904.  
  3905. Alsys, Inc.                                                     (Updated:  May
  3906. 1 992)
  3907.  
  3908. The Alsys Ada Software Development Environment (Alsys's validated Ada compiler
  3909. #901221W1.11103) for 386 UNIX is a production-quality Ada environment capable
  3910. of handling very large Ada applications (over 500,000 lines of code).  The
  3911. product includes the Compiler; Multi-Library Environment, which provides a
  3912. powerful and flexible way to manage Ada development effort and share program
  3913. units; Binder, which supports unused subprograms elimination; High-and Low-
  3914. Level Optimizers for improving code quality and performance; and Run-Time
  3915. Executive for efficient support for executing Ada programs.  Also included is
  3916. the Developer's Toolset including:  Ada Probe, a symbolic source level
  3917. debugger and program viewer; AdaXref, a cross-reference generator; AdaMake, a
  3918. recompilation aid; AdaReformat, a source reformatter.
  3919.  
  3920. Alsys currently has Ada bindings to POSIX, X-Windows (OSF Motif), and the
  3921. Generic Package of Elementary Functions for the Alsys Ada Software Development
  3922. Environment, running on 386 UNIX 386/486-based machines supported as both host
  3923. and target and running 386/ix or SCO UNIX.  They are also planning a binding
  3924. to SQL for  386/486 machines.
  3925.  
  3926. Host/Target:386/486 PC under IX UNIX, 386/486 PC under SCO UNIX
  3927.  
  3928. The Alsys Ada Software Development Environment for the IBM RS/6000 is a
  3929. production-quality Ada environment capable of handling very large Ada
  3930. applications.  Hosted on and targeted to the IBM RS/6000 workstation under
  3931. IBM's AIX operating system, the product includes the Compiler; Multi-Library
  3932. Environment, which provides a  powerful and flexible way to manage Ada
  3933. development efforts and share program units; Binder; Run-Time Executive; and
  3934. both a High and Low-Level Optimizer for improving code quality and
  3935. performance.  Also included is the Alsys Ada Toolset including Ada Probe,
  3936. symbolic source level debugger and program viewer; AdaXref, cross-reference
  3937. generator; AdaMake, recompilation aid; and AdaReformat, source reformatter.
  3938.  
  3939. Alsys has bindings currently available to the Generic Package of Elementary
  3940. Functions and to X-Windows (OSF Motif) for the Alsys Ada Development
  3941. Environment for the IBM RS/6000 running on any RISC System/6000 machine as
  3942. both host and target and running IBM's AIX operating system (Alsys's validated
  3943. Ada compiler #910809W1.11195).   Alsys also plans to develop a POSIX binding
  3944. for the RS/6000.
  3945.  
  3946. Host/Target:RISC System/6000 under AIX
  3947.  
  3948. The Alsys Ada Software Development Environment for SPARC Workstations is a
  3949. production-quality Ada environment capable of handling very large Ada
  3950. applications.  Hosted on any SPARC-based workstation under SunOS or SunView,
  3951. the product helps you realize the full potential of Ada on SPARC machines. The
  3952. product includes the Compiler (with High- and Low-Level Optimizers); Binder,
  3953. which supports unused subprogram elimination; Multi-Library system (Family,
  3954. Library, and Unit Managers) which provides a powerful and flexible way to
  3955. manage Ada development efforts and share program units;  AdaExec real-time
  3956. executive, for complete and efficient support for executing Ada programs; and
  3957. ISO-standard mathematical library.  Also included is the Alsys Ada Toolset
  3958. including AdaProbe, symbolic source level debugger and program viewer;
  3959. AdaXref, cross-reference  generator; AdaMake, recompilation aid; and
  3960. AdaReformat, source reformatter.
  3961.  
  3962. Bindings to the Generic Package of Elementary Functions and to OSF/Motif are
  3963. currently available for the Alsys Ada Software Development Environment running
  3964. on any SPARC-based Workstation as both host and target and running SunOS or
  3965. SunView.
  3966.  
  3967. Host/Target:SPARC under SUNOS
  3968.  
  3969. For more information, contact:Scott Garren, Alsys, Inc., 67 South Bedford
  3970.                         Street, Burlington, MA  01803-5152, USA;  Phone:
  3971.                         (617) 270-0030
  3972.  
  3973.  
  3974. Digital Equipment Corporation                              (Updated:  November
  3975. 1 992)
  3976.  
  3977. Digital Equipment Corporation has bindings available for GKS, PHIGS, SQL, and
  3978. OSF Motif for VAX Ada/VMS.  The Ada bindings are provided either as part of a
  3979. compiler product or the services/facilities that are provided by Digital and
  3980. its suppliers.
  3981.  
  3982. Host/Target:DEC VAX under VMS
  3983.  
  3984. For more information, contact:Mary Anne Cacciola, Digital Equipment
  3985.                         Corporation, 110 Spit Brook Road, Nashua, NH  03062,
  3986.                         USA; Phone:  (603) 881-1028
  3987.  
  3988.  
  3989. IBM                                                        (Updated:  November
  3990. 1 992)
  3991.  
  3992. IBM's AIX Ada/6000 product provides a binding to GPEF and IBM AIXWindows (X-
  3993. Windows ... not Motif).  It runs on all models of the IBM RISC System/6000
  3994. under the IBM AIX Version 3.2 operating system. See also entries for Systems
  3995. Engineering Research Corporation (SERC) and Advanced Technology Center (ATC)
  3996. for Motif, GKS or PHIGS bindings for use with IBM AIX Ada/6000 products.
  3997.  
  3998.  
  3999. The AIX Ada/6000 licensed programs (5706-291 and 5706-294) consist of an
  4000. optimizing compiler, a run-time environment, a symbolic debugger, an Ada
  4001. "makefile" generator for use in automating and minimizing recompilation, Ada
  4002. library management tools and Ada language bindings to some key AIX subsystems.
  4003. With the exception of some system-specific aspects of the language, the Ada
  4004. language for the AIX operating system is source compatible with the Ada
  4005. language supported by IBM licensed programs in VM/CMS and MVS.
  4006.  
  4007. Host/Target:IBM RISC System/6000 under the IBM AIX Version 3.2 operating
  4008.             system
  4009.  
  4010. This product conforms to the following standards:  ANSI/MIL-STD-1815A - Ada at
  4011. current level (1.11) of the ACVC test suite.
  4012.  
  4013. For more information, contact:Barry Lee, IBM Corporation, 844 Don Mills Road,
  4014.                         North York, Ontario, Canada  M3C 1V7; Phone:  (416)
  4015.                         448-3174; Fax: (416) 448-4810
  4016.  
  4017. Objective Interface Systems, Inc.                          (Updated:  November
  4018. 1 992)
  4019.  
  4020. Objective Interface Systems, Inc., has an Ada binding to X-windows (OSF Motif)
  4021. for its Screen Machine~ product.  The Screen Machine binding to Motif includes
  4022. a WYSIWYG drawing tool and an Ada code generator.
  4023.  
  4024. Host/Target:
  4025.  
  4026.       Sun SPARC/SunOS         Rational R1000/Delta    HP 9000/7XX; 8X7
  4027.       IBM RISC System/6000/AIXPC 386/486/ISC UNIX     HFSI WIS Workstation
  4028.       PC 286/386/486/MS-DOS   PC 386/486/SCO UNIX     DEC Ultrix; DEC VMS
  4029.  
  4030. For more information, contact:Phil Carrasco, Object Interface Systems, Inc.
  4031.                         1895 Preston White Drive, Suite 250, Reston, VA
  4032.                         22091-5448, USA; Phone: (703) 264-1900; Fax:
  4033.                         703-264-1721; email info@ois.com (internet)
  4034.  
  4035.  
  4036. SL Corporation                                              (Updated: November
  4037. 1 992)
  4038.  
  4039. SL Corporation's SL-GMS toolkit includes Ada bindings to GPEF, GPPF, POSIX,
  4040. SQL, TCP/IP, OSF/Motif, and Open Look.
  4041.  
  4042. SL-GMS is a toolkit for developing dynamic graphics screens for real-time or
  4043. highly interactive applications.  Non-programmers can design application
  4044. screens in a standard drawing-tool mode, connect them to real-time data
  4045. sources and animate screen objects to visualize changing data values.  SL-GMS
  4046. allows the design of custom "GISMOs" to input values or control the
  4047. application and supports MOTIF, OPEN LOOK and other X toolkit widgets.
  4048.  
  4049. SL-GMS is used extensively to provide real-time graphics for applications in
  4050. the fields of manufacturing, process control, network management, avionics and
  4051. financial tracking.
  4052.  
  4053. Host/Target:Validated Verdix and DEC compilers support SL-GMS for the
  4054.             following machines as both host and target:
  4055.  
  4056.  
  4057.       DEC-DECstation/ULTRIX 4.0DEC-VAXstation/ULTRIX 4.0
  4058.       DEC-VAXstation/VMS 5.4  DEC-VAXstation/VMS 5.5
  4059.  
  4060.       IBM-RS6000/AIX
  4061.  
  4062.       HP-9000/300/UNIX        HP-9000/400/UNIX
  4063.       HP-9000/800/UNIX        HP-9000/700/UNIX
  4064.  
  4065.       PC-386/IX UNIX          PC-386/SCO UNIX
  4066.       PC-386/Lynx             PC-386/0S2
  4067.       PC-386/System 5.4
  4068.  
  4069.       SGI-4D/IRIX 3.3
  4070.  
  4071.       Sun-3/SunOS 4.1         SunSPARC/SunOS 4.1
  4072.  
  4073.       88 Open/BCS Compliant
  4074.  
  4075. For more information, contact: Mike Meagher, SL Corporation, 240 Tamal Vista
  4076.                         Boulevard, Corte Madera, CA  94926, USA Phone: (415)
  4077.                         927-1724; Fax: (415) 927-2931
  4078.  
  4079.  
  4080. Sunrise Software International                                  (Updated:  May
  4081. 1 992)
  4082.  
  4083. Sunrise Software International's product, ezx, is a rapid application
  4084. development tool that automates the creation of graphical user interfaces for
  4085. OSF/MOTIF and generates C, UIL, or Ada.  ezx provides WYSIWYG screen layout;
  4086. color, font and pixmap editors; presentation tools and dialog management.  A
  4087. prototype can be developed in hours and using a script language similar to
  4088. Hypertalk, demonstrated to end-users before the first line of code is written.
  4089. Then portable C, UIL or Ada can be generated automatically.  Ada bindings are
  4090. provided.  The total code required to develop a GUI is reduced by
  4091. approximately 75%.   The appearance and behavior of the GUI is defined in an X
  4092. resource file which the application loads at run time.  This provides explicit
  4093. separation between the GUI and the computational core of the application. Thus
  4094. the GUI can be revised without recompiling (and retesting) the application.
  4095.  
  4096. ezx provides cost savings throughout the software development cycle, from
  4097. requirements analysis through design, code, test and maintenance.
  4098.  
  4099.  
  4100. Host/Target:DEC RISC under ULTRIX, DEC VAX under VMS, IBM 386 under UNIX, IBM
  4101.             RS 6000 under AIX, SGI under , SUN SPARC under UNIX
  4102.  
  4103. For more information, contact:Frederick Sells, Sunrise Software International,
  4104.                         170 Enterprise Center, Middletown, RI  02840, USA;
  4105.                         Phone:  401-847-7868
  4106.  
  4107. Systems Engineering Research Corporation (SERC)            (Updated:  November
  4108. 1 992)
  4109.  
  4110. SERC's Ada/MOTIF is a complete binding to X Window and OSF/Motif for the Ada
  4111. programming language that was based in part upon the SAIC/Unisys (STARS)
  4112. public domain bindings.  That work was leveraged as a starting point for this
  4113. development; many of the bug fixes and additional capabilities beyond the
  4114. public domain releases in Ada/MOTIF have been incorporated.  Most noteworthy
  4115. are the capabilities included in Ada/Motif for Ada tasking, callback
  4116. registration, memory leak detection/prevention and capabilities for developing
  4117. customized widgets.  Paramax/STARS considers Ada/Motif to be the commercial
  4118. version of their STARS bindings, according to SERC.
  4119.  
  4120. Ada/MOTIF is supported by the ALSYS, VERDIX, SUNAda, IBM Ada, and SGI Ada
  4121. compilers.
  4122.  
  4123.  
  4124. Host/Target:SUN 4, HP 300/400, HP 700, IBM RS 6000, SGI, 386
  4125.             SUN OS 4.1.1, SOLARIS 2.0 (coming), HPUX 8.0, SGI 3.2 & 4.0, IBM
  4126.             ATX 3.2, SCO 3.2
  4127.  
  4128. For more information, contact:Theo Kusiolek or Scott Cleveland, Systems
  4129.                         Engineering Research Corporation (SERC), 2555
  4130.                         Charleston Road, Mountain View, CA  94043, USA; Phone:
  4131.                         800-ADA-SERC or 415/962-9092; Fax:  415/962-0330;
  4132.                         E-mail:  Well!sercmail@apple.com.
  4133.  
  4134.  
  4135. TeleSoft                                                   (Updated:  November
  4136. 1 992)
  4137.  
  4138. TeleSoft's TeleUSE/Ada automates the creation of OSF/Motif graphical user
  4139. interfaces for Ada applications.  It includes a special version of the TeleUse
  4140. User Interface Management System -- which generates Ada source code -- and Ada
  4141. bindings to the TeleUSE run-time routines.
  4142.  
  4143. TeleUse/Ada tools allow a GUI to be prototyped and designed using a WYSIWYG
  4144. editor and a PDL, and also includes tools for debugging, generating production
  4145. code and maintaining the GUI.  TeleUse/Ada can save the developer up to 90
  4146. percent of the time required to hand code X Window System GUIs.
  4147.  
  4148. Host/Target:SPARC under UNIX, Sun-4 under UNIX
  4149.  
  4150.  
  4151. TeleSoft's TeleWindows is a set of Ada bindings to the X Window System and
  4152. OSF/Motif.  This includes Xlib, XT, X extensions Library, XT+, X miscellaneous
  4153. utilities, Motif widget set, XM, MWM, Motif resource manager.  It supports X-
  4154. 11 R4 and is not based on the public domain version.  It closely follows the C
  4155. Xlib syntax and allows Ada applications to co-exist with C applications.
  4156.  
  4157. Host/Target:IBM System/370 under VM/CMS
  4158.  
  4159. For more information, contact:Karen Johnson, TeleSoft, 5959 Cornerstone Court
  4160.                         West, San Diego, CA  92121-9891, USA; Phone:  (619)
  4161.                         457-2700
  4162.  
  4163. Verdix                                                          (Updated:  May
  4164. 1 992)
  4165.  
  4166. The Verdix Ada Development System (VADS), is a complete Ada Compiler System
  4167. offering a fully validated Ada compiler with chapter 13 support.  Verdix
  4168. supplies VADSself and VADScross.   VADSself provides a complete toolset for
  4169. self-targeted applications.  It easily interfaces to databases, windowing
  4170. systems and program management tools.  VADScross provides real-time support
  4171. for host-to-target system development.  VADScross produces small and fast
  4172. object code.  VADS is hosted on the largest number of platforms and targets
  4173. the greatest number of microprocessors.
  4174.  
  4175. Host/Target:88000 BCS under UNIX, DEC VAX under VMS / ULTRIX / UNIX,
  4176.             DECStation (RISC) under UNIX, DECSystem (RISC) under UNIX, HP 9000
  4177.             Series 300 under HP-UX  (UNIX), IBM PS/2 under AIX  (UNIX), IBM
  4178.             RISC System/6000 under AIX, SCO Systems V/386 (ABI) under UNIX,
  4179.             Sun SPARC systems under UNIX, Sun-3 systems under UNIX
  4180.  
  4181. Verdix AXI provides an Ada binding to the full Motif, Xt, and Xlib libraries.
  4182. The product works with user-supplied Motif 1.1 and X11R4 libraries regardless
  4183. of source.
  4184.  
  4185. Host/Target:DEC RISC under Ultrix, IBM RS6000 under AIX, MIPS under MIPSos,
  4186.             Sun-4 under SunOS, Sys V386 under ISC UNIX, Sys V386 under SCO
  4187.             UNIX
  4188.  
  4189. For more information, contact:Tim Ruhe, Verdix Corporation, 205 Van Buren,
  4190.                         Herndon, VA  22070, USA; Phone:  (703) 318-5800
  4191.  
  4192. Answer: Integrated Computer Solutions, Inc. (ICS) supplies Ada bindings to
  4193. Motif for a number of platforms and Ada compilers.  ICS also provides Builder
  4194. Xcessory, a Motif interface builder, which outputs Ada code usable with the
  4195. Ada bindings.  The product family is known collectively as the Ada Xcessories.
  4196.  
  4197. Integrated Computer Solutions, Inc. (ICS) 201 Broadway, Cambridge, MA  02139
  4198. USA info@ics.com   617/621-0060
  4199.  
  4200.  
  4201.  
  4202. -----------------------------------------------------------------------------
  4203. Subject: 112)  Is there a Poplog binding for Motif?
  4204.  
  4205. [Last modified: May]
  4206.  
  4207. Answer:
  4208.  A integrated programming environment consisting of the programming
  4209.     languages Pop-11, Prolog, Standard ML, and Lisp which are compiled
  4210.     to machine code via a common virtual machine. Pop-11 provides a rich
  4211.     interface to the X Toolkit which can be accessed from all other
  4212.     Poplog languages. The OLIT, Motif, and Athena widget sets are
  4213.     supported, in addition to the custom Poplog (Xpw) widget set. XVed
  4214.     provides a sophisticated, customisable multi-window editor. Under
  4215.     OPEN LOOK and Motif the Poplog User Interface (PUI) provides a
  4216.     graphical interface to the Poplog system. High-level Pop-11
  4217.     libraries allow graph drawing, turtle graphics, and the simple
  4218.     creation of basic button/menu based interfaces.
  4219.  
  4220. Contact:
  4221.  
  4222.     UK EDUCATION SITES:
  4223.         Poplog Sales. School of Cognitive and Computing Sciences.
  4224.         Brighton. BN1 9QN. England.
  4225.         Phone: +44 (0)273 678188
  4226.         Email: popsales@cogs.susx.ac.uk
  4227.     USA AND CANADIAN EDUCATION SITES:
  4228.         Computable Functions Inc. 35 South Orchard Drive. Amherst.
  4229.         MA 01002. USA.
  4230.         Phone: (413) 253-7637
  4231.     ALL OTHER SALES:
  4232.         Integral Solutions Ltd. Unit 3, Campbell Court. Bramley.
  4233.         Basingstoke. Hampshire. RG26 5EG. England.
  4234.         Phone:  +44 (0)256 882028
  4235.         Fax:    +44 (0)256 882182
  4236.         Email:  isl@integ.uucp
  4237.  
  4238.  
  4239.  
  4240. -----------------------------------------------------------------------------
  4241. Subject: 113)  TOPIC: SPECIFIC PLATFORMS
  4242.  
  4243. -----------------------------------------------------------------------------
  4244. Subject: 114)  Is it easy to build Motif for a Sun?
  4245.  
  4246. Answer: See next question for Solaris 2.  No pattern has emerged to problems
  4247. about compiling Motif on the Sun (although people seem to have a lot of
  4248. different minor problems), and many reports are that it is straightforward.
  4249. Read the Motif install instructions (which often have specific reference to
  4250. Sun installation), light the blue touch paper and just standback. [My
  4251. experience was that I had to add -D_NO_PROTO for 1.1 on a Sparc OS 4.1, and
  4252. that was all.  Others have added STRINGS_ALIGNED and NO_REGEXP].
  4253.  
  4254.  
  4255. -----------------------------------------------------------------------------
  4256. Subject: 115)  How do I build Motif 1.2.2 on Solaris 2.1 with Sun C?
  4257.  
  4258. [Last modified: May 93]
  4259.  
  4260. Prepared by Ric Steinberger.  ric@updike.sri.com  4/09/93
  4261.  
  4262. What follows is a description of the steps I used to build Motif 1.2.2 on a
  4263. SUN IPX running Solaris 2.1.  Sun's C compiler (2.0.1) was used.  Many thanks
  4264. go to Kaleb Keithley (kaleb@devvax.jpl.nasa.gov) for several useful
  4265. suggestions.  Other people, including OSF staff, especially David Brooks
  4266. (dbrooks@osf.org), helped as well.  My thanks to you all.
  4267.  
  4268. 1. Build X11R5 from the mit distribution.  You need to retrieve the sources
  4269.    from export.lcs.mit.edu (in pub/R5) and patches 1 - 22 (or 23) (in
  4270.    pub/R5/fixes).  There are several other sites that contain the X11R5
  4271.    sources.  After installing patch 19, apply PEXlib.tar.Z, also available
  4272.    from export.lcs.mit.edu in pub/R5/fixes.  You can apply also
  4273.    R5.Xsun.multi-screen and R5.SunOS5.patch.  There are .README files
  4274.    that explain how to patch.  Be SURE to read
  4275.    R5.SunOS5.patch.README for details on how to BUILD X11.  You probably
  4276.    want to use the ProjectRoot feature in the site.def file in the
  4277.    mit/config directory.  You will NEED to edit that file to do that.
  4278.  
  4279. 2. Obtain the Motif 1.2.2 distribution from OSF (617-621-7300).  You may
  4280.    need to first install the 1.2 tape, then the 1.2.1 and finally the
  4281.    1.2.2 tape.  You might want to do a "chmod -R u+w ." after unloading
  4282.    each tape.
  4283.  
  4284. 3. In the config directory, there are several changes.  Some of the changes
  4285.    are based on R5.SunOS5.patch files.  A complete set of config files
  4286.    relevant to Solaris have been placed in the anon-ftp account of
  4287.    updike.sri.com in pub/motif/solaris21-motif122-config.tar.Z.  They are
  4288.    also available from OSF on their mail response server (available to
  4289.    support contract holders) and they will send them directly to full
  4290.    support contract holders.  Decompress and untar this file in your Motif
  4291.    config subdirectory.  Copy site.def.sample to site.def, then edit
  4292.    site.def.  You will probably want to uncomment the ProjectRoot section
  4293.    and use the same value used in your X11R5 build.  Also, you will probably
  4294.    want to use /usr/ucb/install in you installed the UCB compatibility
  4295.    suite.  Otherwise you might want to use the install supplied at the end
  4296.    of this memo.  [I used the UCB version and can't swear that this works.
  4297.    Bit it should.  Put it someplace like /usr/local/bin and chmod +x it.]
  4298.  
  4299.    There are two patches to consider.  One fixes a cursor problem
  4300.    in ./lib/Xm/TextF.c.  The other removes a Berkeleyism.  These
  4301.    patches should probably be consider unofficial at present.
  4302.    Failure to deal with the Berkeleyism (bzero) means you will need to
  4303.    link with -lucb -lelf.  This will probably work, but why bother?
  4304.    Furthermore, if you move the Motif binaries to a machine without
  4305.    the ucb compatability suite, you won't have the sharable libs you need.
  4306.  
  4307. [The actual patches have been censored because they contain OSF source code]
  4308.  
  4309.    Patch 1: In TextF.c there are several places _XmTextFieldDrawInsertionPoint
  4310. is called. These should be moved two or three lines further down *after* the
  4311. "if (!XtIsRealized(tf)) return True;" statement.
  4312.  
  4313.  
  4314.    patch 2: The call to bzero in lib/Xm/Visual.c should be replaced by the
  4315. equivalent call to memset
  4316.  
  4317.  
  4318.     Both these patches can be applied in the ./lib/Xm directory.
  4319.     If you don't have the patch program (how did you build X11?),
  4320.     you can get it in the vendor/cygnus directory of ftp.uu.net,
  4321.     or you can build it from source.  Be sure to get the latest
  4322.     version (2.0.12.u8).
  4323.  
  4324. 4) Use the README-1.2.1 file as a guideline for building motif.  I followed
  4325.    directions in the section called, "Using X11R5 Installed Libraries
  4326.    and Header Files."  If you make a mistake after your first build
  4327.    attempt, copy Makefile.ini to Makefile before retrying.  You may
  4328.    need to do this in the config subdirectory too, depending on what
  4329.    went wrong.
  4330.  
  4331. 5) After make Makefiles, do make includes, make depend, then make (or
  4332.    as OSF recommends, make -k).  This gets as far as motifshell in the
  4333.    demos, which fails to build because O_RDONLY and L_XTND are
  4334.    not defined.  O_RDONLY is in fcntl.h (actually <sys/fcntl.h>, but
  4335.    fcntl.h includes this.)  L_XTND can be replaced by SEEK_END.
  4336.    SEEK_END is in stdio.h.  These two fixes will allow motifshell to build.
  4337.    Note: many MANY compiler warning messages will be generated during
  4338.    the build process.
  4339.  
  4340. 6) You can go to the demos/xmsamplers directory and do a make there.
  4341.    Other demos may build, or not depending on whatever. . . .
  4342.  
  4343. 7) make install will do the install.  [It will fail at motifshell
  4344.    if you don't fix it, as mentioned above.]  You can do a make install
  4345.    in demos/xmsamplers if you want these.
  4346.  
  4347. 8) If running on a SUN (as opposed to an X term), you will (probably) need
  4348.    to start openwin with something like:
  4349.  
  4350.         openwin -server /usr/X11R5/bin/Xsun
  4351.  
  4352.  
  4353.    [You might want to use an alias for this.]
  4354.    This fixes an annoying problem: The mouse keys stop working after you
  4355.    click on an icon to get the icon menu (on SUNs only, not X terms).
  4356.    The ALT keys still work, if you get stuck.  I don't know whether this
  4357.    is a bug in SUN's server or whether it is Motif related.
  4358.  
  4359.    Here is a copy of my .xinitrc:  It's not elegant.  Sun's default
  4360.    openwin startup file is in: /usr/openwin/lib/Xinitrc.  You can
  4361.    copy this to ~/.xinitrc and customize as desired.  Obviously, the
  4362.    default behavior is to start the OpenLook environment (boo!).
  4363.  
  4364.  
  4365. #!/bin/sh
  4366. #
  4367. # .xinitrc - OpenWindows startup script.
  4368. #
  4369. if [ -f $HOME/.Xdefaults ]; then
  4370.     xrdb $HOME/.Xdefaults              # Load Users X11 resource database
  4371. fi
  4372. if [ -f $HOME/.Xdefaults.sun ]; then
  4373.     xrdb -merge $HOME/.Xdefaults.sun
  4374. fi
  4375. DISPLAY=`hostname`:0.0
  4376. export DISPLAY
  4377. xhost + > /dev/null
  4378. #xterm -sb -sl 512 -T `hostname` -ls -n `hostname` &
  4379. xterm -sb -sl 512 -T `hostname` -n `hostname` &
  4380. mwm &
  4381. xclock -geometry +1010+0 &
  4382. xload -geometry +710+5 -fg red &
  4383. xsetroot -solid salmon &
  4384. xterm -sb -sl 100 -T CONSOLE_DO_NOT_LOGOUT -C -n console -iconic
  4385. #wait
  4386.  
  4387. Here's .Xdefaults.sun, which gives me a more readable font for use with
  4388. motif on Sun monitors:
  4389.  
  4390. !Some additional .Xdefaults values specifically for SUN
  4391. !
  4392. ! After loading .Xdefaults, xrdb -merge .Xdefaults.sun
  4393. !
  4394. Mwm*fontList:           8x16
  4395. !Mwm*fontList:          vtbold
  4396. !Change as desired.
  4397.  
  4398.  
  4399.      You will probably want to maintain LD_LIBRARY_PATH to something like:
  4400. /opt/SUNWspro/lib:/usr/ccs/lib:/usr/ucblib:/usr/X11R5/lib:/usr/lib:
  4401. /usr/openwin/lib.  If you use emacs, you will need to leave /usr/openwin/lib
  4402. there.  [This is because you probably, like me, used the distributed version
  4403. of s-sol2.h, which explicitly refers to windowing libraries as being in the
  4404. /usr/openwin locations.  Yes, I know that emacs/Solaris ought to allow
  4405. LibXt.so.N.M to be "picked up" from elsewhere, like /usr/X11R5/lib, but the
  4406. one emacs links with is LibXt.so.4.something, and the mit one is
  4407. LibXt.so.5.something.  So it seems to want the .4 one.  Any comments?  I'd
  4408. prefer not to rebuild emacs based on the X11R5 libs because I occassionally
  4409. need to move the emacs binaries to machines without the mit files.]
  4410.  
  4411. -----------------------------------------------------------------------------
  4412. Subject: 116)  What compile errors/warnings might I get in both Sun 3 and Sun
  4413. 4?
  4414.  
  4415. Answer:
  4416.  
  4417.  
  4418. make: Warning: Too many rules defined for target
  4419. make: Warning: Too many rules defined for target
  4420. "callbacks.c", line 1530: warning: illegal combination of pointer
  4421. and integer, op =
  4422. "callbacks.c", line 1531: warning: illegal combination of pointer
  4423. and integer, op =
  4424. "callbacks.c", line 1532: warning: illegal combination of pointer
  4425. and integer, op =
  4426. "utils.c", line 73: warning: illegal combination of pointer and integer, op =
  4427. "utils.c", line 74: warning: illegal combination of pointer and integer, op =
  4428. "utils.c", line 122: warning: illegal combination of pointer and integer, op =
  4429. "utils.c", line 123: warning: illegal combination of pointer and integer, op =
  4430. "utils.c", line 191: warning: illegal combination of pointer and integer, op =
  4431. "utils.c", line 194: warning: illegal combination of pointer and integer, op =
  4432. "utils.c", line 195: warning: illegal combination of pointer and integer, op =
  4433. "utils.c", line 196: warning: illegal combination of pointer and integer, op =
  4434. "utils.c", line 316: warning: illegal combination of pointer and integer, op =
  4435. "utils.c", line 334: warning: illegal combination of pointer and integer, op =
  4436. "utils.c", line 338: warning: illegal combination of pointer and integer, op =
  4437. "utils.c", line 341: warning: illegal combination of pointer and integer, op =
  4438. "xmdialogs.c", line 838: warning: illegal combination of pointer
  4439. and integer, op =
  4440. "xmeditor.c", line 1152: warning: illegal combination of pointer
  4441. and integer, op =
  4442.  
  4443. These warning messages can be ignored. OSF is aware of these warnings.
  4444.  
  4445.  
  4446. -----------------------------------------------------------------------------
  4447. Subject: 117)  On a Sun 3, what are the mwm startup error messages about?  I
  4448. get
  4449.  
  4450. mwm: Invalid accelerator specification on line 7 of
  4451.      specification string
  4452. mwm: Invalid accelerator specification on line 31 of
  4453.       configuration file
  4454.  
  4455.  
  4456. Answer: This is because some Sun keyboards do not have an F10 key and some sun
  4457. workstations which have an F10 key do not have X-servers which recognize it.
  4458. The F10 key is used by mwm.  If the machine does have an F10 key, the user
  4459. should use xmodmap to tell the server it exists.  Otherwise, change the
  4460. definition of the DefaultWindowMenu in /usr/lib/X11/system.mwmrc (after
  4461. installation) or in /lib/clients/mwm/system.mwmrc (before installation).
  4462. Change the accelerator of "Maximize" (it is "Alt<Key>F10)" to something else.
  4463. Also, you should change the definition of DEFAULTSYSTEMMENU in the file
  4464. /clients/mwm/WmResource.c in a similar fashion.  There is as yet no standard
  4465. redefinition for F10.
  4466.  
  4467.  
  4468.  
  4469. -----------------------------------------------------------------------------
  4470. Subject: 118)  Are there problems making shared libraries on a Sun?
  4471.  
  4472. Answer: If you use the -pic option you may run out of offset table space.  use
  4473. the -PIC option instead.
  4474.  
  4475. You may get the message "ld.so: Undefined symbol: __XtInherit" when executing
  4476. UIL. There is a problem in shared library build when you compare a function
  4477. variable to a routine name, but don't call the routine.  Either, you can build
  4478. the Xt library nonshared, or you can put a reference to XtToolkitInitialize in
  4479. the UIL main program (or even include a module that references it).  The
  4480. routine doesn't even have to be called; it just has to be there.
  4481.  
  4482.  
  4483. -----------------------------------------------------------------------------
  4484. Subject: 119)  The OpenWindows server hangs when I popup a menu with Button 3.
  4485. [Last modified: August 92]
  4486.  
  4487. Answer: This is an OpenWindows problem, but if you have Motif source you can
  4488. fix your own applications. From Steve Sistare of Thinking Machines Corp.:
  4489. "Change the 2 calls to XtGrabButton in RowColumn.c such that ButtonReleaseMask
  4490. | ButtonPressMask is passed for the event mask.  Currently, only
  4491. ButtonReleaseMask is passed.  Also, change the owner_event argument to FALSE.
  4492. " This has not been fixed in Motif as at 1.1.5.
  4493.  
  4494. -----------------------------------------------------------------------------
  4495. Subject: 120)  Has anyone made shared libraries on an IBM RS/6000?
  4496.  
  4497. Answer: From Sakari Jalovaara: There is a problem: Xm redefines VendorShell
  4498. and the AIX linker put _both_ Xm's and Xt's VendorShell into programs.  When
  4499. an AIX shared library is created as many references inside the library are
  4500. resolved as possible.  If the symbol vendorShellClassRec is defined in libXt
  4501. and referenced, say, from a function XtFoo() also in libXt, the "ld" run that
  4502. creates the shared library resolves the reference:
  4503.  
  4504.         XtFoo() -> vendorShellClassRec
  4505.  
  4506. Then I create the Motif library that has its own vendorShellClassRec and an
  4507. XmBar() function that uses it; libXm will also contain a resolved reference to
  4508. vendorShellClassRec:
  4509.  
  4510.         XmBar() -> vendorShellClassRec
  4511.  
  4512. Finally, I link a program that uses both XtFoo() and XmBar() and the program
  4513. will end up with _two_ independent "vendorShellClassRec"s:
  4514.  
  4515.         XtFoo() -> vendorShellClassRec [Xt version]
  4516.         XmBar() -> vendorShellClassRec [Xm version]
  4517.  
  4518. Instant schizo zaphod mode.  In reality, vendorShellClassRec is not referenced
  4519. from functions but from other widget class records.
  4520.  
  4521. I can't just pull Vendor.o out from the shared Xt (Vendor.o appears to define
  4522. the only external symbols redefined by libXm) because AIX shared libraries
  4523. apparently can't contain unresolved external references.  If I take out
  4524. Vendor.o I have to take out every other file that uses symbols defined there -
  4525. and then files that need those files, etc.  I tried it and ended up with three
  4526. or four object files in libXt and the res non-sharable.
  4527.  
  4528. I kludged around this by putting all of libXt (minus Vendor.o) into the shared
  4529. libXm.  It isn't a pretty solution but it works - and beats having a
  4530. statically linked two-megabyte "periodic" demo...
  4531.  
  4532.  
  4533. -----------------------------------------------------------------------------
  4534. Subject: 121)  What is the error  "Unaligned access in XmString" under Ultrix?
  4535.  
  4536. Answer: Compile  XmString.c with STRINGS_ALIGNED.
  4537.  
  4538. -----------------------------------------------------------------------------
  4539. Subject: 122)  TOPIC: KEYSYMS
  4540.  
  4541. -----------------------------------------------------------------------------
  4542. Subject: 123)  What is causing the messages "unknown keysym osfDown..."?  It
  4543. happens when I run an application under Motif 1.1
  4544.  
  4545. Answer: There is an OSF supplied addition to the /usr/lib/X11/XKeysymDB file.
  4546. It is found on the release tape and should have been automatically installed
  4547. if the installation procedure was followed in the Release Notes.
  4548.  
  4549. You have to copy (or append) lib/Xm/XKeysymDB into /usr/lib/X11.  This may
  4550. require root permission.  It is not clear how to fix the problem if you can't
  4551. do this.  The error comes from Xt translation table parsing and can't be fixed
  4552. in Motif, so if you can't get root permission you may be stuck.  The file is
  4553. not copyrighted so you can install it on other systems.
  4554.  
  4555. If X has been built so that XKeysymDB is not in this directory, and you don't
  4556. know where it is looking, run 'strings libX11.a | grep XKeysymDB' to find the
  4557. path.
  4558.  
  4559. On a Sun running openwin with shared libraries, you may need to put the path
  4560. for the library containing XKeysymDB *first* in the path list in
  4561. LD_LIBRARY_PATH, or it may find the wrong XKeysymDB in the wrong directory.
  4562.  
  4563. XKeysymDB simply contains the registered keysym values for the OSF keysyms.
  4564. The OSF values are server-independent.  And, all registered keysyms will be
  4565. included in an XKeysymDB file to be shipped with X11R5.
  4566.  
  4567. In the meantime (till all systems are X11R5+), a list of the registered
  4568. keysyms can be found in the X11R4 release in mit/doc/Registry/Xregistry.
  4569.  
  4570. Also note the XKEYSYMDB environment variable. Setting this to point to the
  4571. XKeysymDB file often helps, but not always...
  4572.  
  4573.  
  4574. -----------------------------------------------------------------------------
  4575. Subject: 124)  What happens if I can't install Motif Keysyms?
  4576.  
  4577. From: tessi!george@nosun.West.Sun.COM (George Mitchell)
  4578.  
  4579. Here's what appears to happen if you don't have XKeysymDB in place to define
  4580. OSF's virtual keysyms:
  4581.  
  4582. 1. At class initialize time, for a widget (such as XmText) that uses virtual
  4583. keysyms in its event translation table, all entries which refer to those
  4584. keysyms fail to parse correctly.  In the case of XmText, instead of ending up
  4585. with a translation table with roughly 90 entries, you end up with one that has
  4586. 29.
  4587.  
  4588. 2. XKeysymDB doesn't exist, so you'd assume that KeyPress events will get
  4589. translated to plain vanilla keysyms, right?  WRONG!  All Motif widgets install
  4590. a virtual keysym translator ANYWAY!  Consequently, the backspace key (for
  4591. example) gets translated to the keysym osfBackSpace.
  4592.  
  4593. 3. Therefore, if you augment or override your widget's translations with
  4594. translations that refer to plain vanilla BackSpace, they will never be
  4595. triggered, because you will NEVER see plain vanilla BackSpace, only
  4596. osfBackSpace.
  4597.  
  4598. 4. But you can't use osfBackSpace in an event translation entry, because you
  4599. don't have XKeysymDB installed!
  4600.  
  4601. Here's how I'm "dealing" with the problem right now: Motif installs its
  4602. virtual keysym translator by calling XtSetKeyTranslator every time a
  4603. VendorShell (or subclass) widget is created.  So every time I create a shell,
  4604. I immediately call XtSetKeyTranslator (display, XtTranslateKey) to restore the
  4605. default translator.  No more funny virtual keysyms!  Now I can reinstall non-
  4606. osfKeySym translations and have them work the way I expect.
  4607.  
  4608.  
  4609. -----------------------------------------------------------------------------
  4610. Subject: 125)  Why has OSF introduced Keysyms into Motif 1.1?  They weren't
  4611. there in Motif 1.0.
  4612.  
  4613. Answer: From: ellis@osf.org
  4614.  
  4615. Virtual Keysyms are meant to provide a consistent keyboard model for Motif
  4616. applications running in a heterogeneous environment in which proprietary (i.e.
  4617. vendor specific) non-Motif applications may also be running.
  4618.  
  4619. First of all, for the sake of the rest of the readers, let's explain why this
  4620. is an issue:
  4621.  
  4622. It would be lovely if Motif's translation tables could just use the obvious
  4623. keysyms predefined by X.  For example, there are keysyms for XK_BackSpace,
  4624. XK_Delete, XK_Left, XK_Right, etc.  Shouldn't these be the ones that are used
  4625. in our translations?  Unfortunately, the problem is not so simple.  Some
  4626. specific examples:
  4627.  
  4628.    While most vendors bind XK_BackSpace to the key at the top right
  4629.    of the standard keyboard (often engraved with a leftwards
  4630.    pointing arrow), not all do.  In fact, some vendors (including DEC)
  4631.    bind that key to XK_Delete.
  4632.  
  4633.    While most vendors bind the arrow keys to XK_Up, etc, a number of
  4634.    vendors (including Sun, on some servers) bind them to function key
  4635.    keysyms.
  4636.  
  4637. A simplistic solution would require the use of xmodmap to change the offending
  4638. bindings.  That would work swell in an all Motif environment.  However, OSF's
  4639. goal (not always perfectly achieved) is interoperability.  That is, we'd like
  4640. to make sure that both Motif and non-Motif programs can happily run in the
  4641. same environment.
  4642.  
  4643. It is expected that a vendor may have a wide variety of existing X-based
  4644. software that uses the keysyms as established by that vendor for specific
  4645. purposes.  It is expected that these applications may run at the same time as
  4646. Motif-based software.  Using xmodmap to change keysyms on the server side
  4647. could "break" the existing applications (or at the very least their
  4648. documentation) by making some keys unavailable, or by moving the location.
  4649.  
  4650. So, we chose not to use xmodmap.  By the way, though OpenLook uses a different
  4651. implementation (they recompile their virtual translation tables into actual
  4652. translation tables), they basically adopted the same approach, presumably for
  4653. similar reasons.
  4654.  
  4655. To work properly, the virtual keysym model we implemented depends on Xlib
  4656. finding XKeysymDB installed appropriately (which standard Motif installation
  4657. does).  This simply defines the keysyms (not the key they are bound to).  This
  4658. unfortunate piece of stupidity is necessary because MIT only includes standard
  4659. keysyms in keysymdef.h.  It should be said that our lives would be made easier
  4660. if MIT would also see fit to include registered keysyms in keysymdef.h as
  4661. well.
  4662.  
  4663. Motif applications determine how to bind virtual to actual keys by looking for
  4664. either a resource or a property on the root window which describes what to do.
  4665. Note that this information is on the server side, so that all applications use
  4666. the same virtual bindings regardless of where they are running.  Mwm will
  4667. happily create the property if it finds a .motifbind file in your home
  4668. directory when it starts up.  (Actually, things generally work even if none of
  4669. this is done, since if all else fails, the Motif toolkit chooses a virtual
  4670. bindings table to use based on the identification of the server).
  4671.  
  4672. The actual implementation of virtual keys is made possible by a hook in the
  4673. Intrinsics.  Undoubtably, the implementation would be simpler and cleaner if
  4674. virtual key support was more directly supported by the Intrinsics.  We will be
  4675. exploring this possibility in the future.
  4676.  
  4677.   -- Ellis
  4678.  
  4679. -----------------------------------------------------------------------------
  4680. -----------------------------------------------------------------------------
  4681. Subject: 126)  TOPIC: ICONS
  4682.  
  4683. Iconification/de-iconification is a co-operative process between a client and
  4684. a window manager.  The relevant standards are set by ICCCM.  Mwm is ICCCM
  4685. compliant.  The toplevel (non-override-redirect) windows of an application may
  4686. be in three states: WithdrawnState (neither the window nor icon visible),
  4687. NormalState (the window visible) or IconicState (the icon window or pixmap
  4688. visible).  This information is contained in the WM_STATE property but ordinary
  4689. clients are not supposed to look at that (its values have not yet been
  4690. standardised).  Movement between the three states is standardised by ICCCM.
  4691.  
  4692. -----------------------------------------------------------------------------
  4693. Subject: 127)  How can I keep track of changes to iconic/normal window state?
  4694.  
  4695. Answer: You can look at the WM_STATE property, but this breaks ICCCM
  4696. guidelines.  ICCCM compliant window managers will map windows in changing them
  4697. to normal state and unmap them in changing them to iconic state. Look for
  4698. StructureNotify events and check the event type:
  4699.  
  4700.         XtAddEventHandler (toplevel_widget,
  4701.                         StructureNotifyMask,
  4702.                         False,
  4703.                         StateWatcher,
  4704.                         (Opaque) NULL);
  4705.         ....
  4706.         void StateWatcher (w, unused, event)
  4707.         Widget w;
  4708.         caddr_t unused;
  4709.         XEvent *event;
  4710.         {
  4711.                 if (event->type == MapNotify)
  4712.                         printf ("normal\n");
  4713.                 else if (event->type == UnmapNotify)
  4714.                         printf ("iconified\n");
  4715.                 else    printf ("other event\n");
  4716.         }
  4717.  
  4718.  
  4719. If you insist on looking at WM_STATE, here is some code (from Ken Sall) to do
  4720. it:
  4721.  
  4722.         /*
  4723.         ------------------------------------------------------------------
  4724.         Try a function such as CheckWinMgrState below which returns one of
  4725.         IconicState | NormalState | WithdrawnState | NULL :
  4726.         ------------------------------------------------------------------
  4727.         */
  4728.         #define WM_STATE_ELEMENTS 1
  4729.  
  4730.         unsigned long *CheckWinMgrState (dpy, window)
  4731.         Display *dpy;
  4732.         Window window;
  4733.         {
  4734.           unsigned long *property = NULL;
  4735.           unsigned long nitems;
  4736.           unsigned long leftover;
  4737.           Atom xa_WM_STATE, actual_type;
  4738.           int actual_format;
  4739.           int status;
  4740.  
  4741.             xa_WM_STATE = XInternAtom (dpy, "WM_STATE", False);
  4742.  
  4743.             status = XGetWindowProperty (dpy, window,
  4744.                           xa_WM_STATE, 0L, WM_STATE_ELEMENTS,
  4745.                           False, xa_WM_STATE, &actual_type, &actual_format,
  4746.                           &nitems, &leftover, (unsigned char **)&property);
  4747.  
  4748.             if ( ! ((status == Success) &&
  4749.                         (actual_type == xa_WM_STATE) &&
  4750.                         (nitems == WM_STATE_ELEMENTS)))
  4751.                 {
  4752.                 if (property)
  4753.                     {
  4754.                     XFree ((char *)property);
  4755.                     property = NULL;
  4756.                     }
  4757.                 }
  4758.             return (property);
  4759.         } /* end CheckWinMgrState */
  4760.  
  4761.  
  4762. -----------------------------------------------------------------------------
  4763. Subject: 128)  How can I check if my application has come up iconic?  I want
  4764. to delay initialisation code and other processing.
  4765.  
  4766. Answer: Use XtGetValues and check for the XmNinitialState value of the
  4767. toplevel shell just before XtMainLoop. -- IconicState is iconic, NormalState
  4768. is not iconic.
  4769.  
  4770.  
  4771.  
  4772.  
  4773. -----------------------------------------------------------------------------
  4774. Subject: 129)  How can I start my application in iconic state?
  4775.  
  4776. Answer: From the command line
  4777.  
  4778.         application -iconic
  4779.  
  4780. Using the resource mechanism, set the resource XmNinitialState to IconicState
  4781. of the toplevel shell widget (the one returned from XtInitialise).
  4782.  
  4783. -----------------------------------------------------------------------------
  4784. Subject: 130)  How can an application iconify itself?
  4785.  
  4786. Answer: In R4 and later, use the call XIconifyWindow.
  4787.  
  4788. For R3, send an event to the root window with a type of WM_CHANGE_STATE and
  4789. data IconicState.
  4790.  
  4791.         void
  4792.         IconifyMe (dpy, win)
  4793.         Display *dpy;
  4794.         Window win;     /* toplevel window to iconify */
  4795.         {
  4796.                 Atom xa_WM_CHANGE_STATE;
  4797.                 XClientMessageEvent ev;
  4798.  
  4799.                 xa_WM_CHANGE_STATE = XInternAtom (dpy,
  4800.                                         "WM_CHANGE_STATE", False);
  4801.  
  4802.                 ev.type = ClientMessage;
  4803.                 ev.display = dpy;
  4804.                 ev.message_type = xa_WM_CHANGE_STATE;
  4805.                 ev.format = 32;
  4806.                 ev.data.l[0] = IconicState;
  4807.                 ev.window = win;
  4808.  
  4809.                 XSendEvent (dpy,
  4810.                         RootWindow (dpy, DefaultScreen(dpy)),
  4811.                         True,
  4812.                         (SubstructureRedirectMask | SubstructureNotifyMask),
  4813.                         &ev);
  4814.                 XFlush (dpy);
  4815.         }
  4816.  
  4817.  
  4818. -----------------------------------------------------------------------------
  4819. Subject: 131)  How can an application de-iconify itself?
  4820.  
  4821. Answer: XMapWindow (XtDisplay (toplevel_widget), XtWindow (toplevel_widget)).
  4822.  
  4823. -----------------------------------------------------------------------------
  4824. Subject: 132)  TOPIC: MISCELLANEOUS
  4825.  
  4826. -----------------------------------------------------------------------------
  4827. Subject: 133)+ How do I controll the repeat rate on a SUN keyboard ??
  4828.  
  4829.  
  4830. Answer:
  4831.  
  4832.      [...]
  4833.  
  4834.      -ar1 milliseconds
  4835.              This option specifies amount of time in milliseconds
  4836.              before   which   a   pressed  key  should  begin  to
  4837.              autorepeat.
  4838.  
  4839.      -ar2 milliseconds
  4840.              This option specifies the interval  in  milliseconds
  4841.              between autorepeats of pressed keys.
  4842.  
  4843. Of course this presumes you're using a server based on the MIT sample server.
  4844. submitted by: kaleb@x.org (Kaleb Keithley)
  4845.  
  4846. -----------------------------------------------------------------------------
  4847. Subject: 134)  How can I identify the children of a manager widget?
  4848.  
  4849. Answer: XmNnumChildren (number of widgets in array).
  4850.  
  4851. -----------------------------------------------------------------------------
  4852. Subject: 135)  How do I tell if a scrolled window's scrollbars are visible?
  4853.  
  4854. Answer: Use XtGetValues() to get the scrollbar widget ID's, then use
  4855. XtIsManaged() to see if they are managed (visible).
  4856.  
  4857. thanks to Ken Lee, klee@synoptics.com
  4858.  
  4859. -----------------------------------------------------------------------------
  4860. Subject: 136)  How can I programatically scroll a XmScrolledWindow in
  4861. XmAUTOMATIC mode?
  4862.  
  4863. Answer: In Motif 1.2, use XmScrollVisible().  If you're using a scrolled text
  4864. or scrolled list combination widget, use XmTextScroll() or XmListSet*()
  4865. instead.
  4866.  
  4867. The Motif manuals specifically forbid manipulating the scrollbars directly,
  4868. but some people have reported success with XmScrollBarSetValues, with the
  4869. "notify" parameter set to "True".
  4870.  
  4871. thanks to Ken Lee, klee@synoptics.com
  4872.  
  4873. -----------------------------------------------------------------------------
  4874. Subject: 137)  What functions can an application use to change the size or
  4875. position of a widget?
  4876.  
  4877. Answer: Applications should set the values of the XmNx, XmNy, XmNwidth, and
  4878. XmNheight resources.
  4879.  
  4880. Note their
  4881. children, relying instead on their internal layout algorithms.  If you really
  4882. want specific positions, you must use a manager widget that allows them, e.g.,
  4883. XmBulletinBoard.
  4884.  
  4885. Also note that some manager widgets reject size change requests from their
  4886. children when certain resources are set (e.g., XmNresizable on XmForm).
  4887. Others allow the the children to resize, but clip the results (e.g.,
  4888. XmNallowShellResize on shell widgets).  Make sure you have these resources set
  4889. to the policy you want.
  4890.  
  4891. Due to bugs, some widgets (third party widgets) do not respond to changes in
  4892. their width and height.  Sometimes, you can get them to respond correctly by
  4893. unmanaging them, setting the resources, then managing them again.
  4894.  
  4895. Under no circumstances should applications use routines like
  4896. XtConfigureWidget() or XtResizeWidget().  These routines are reserved for
  4897. widget internals and will seriously confuse many widgets.  _ thanks to Ken
  4898. Lee, klee@synoptics.com ----------
  4899. -------------------------------------------------------------------
  4900. Subject: 138)  What widgets should I use to get the look of push buttons, but
  4901. the behaviour of toggle buttons?
  4902.  
  4903. Answer:
  4904.   Use the XmToggleButton widget, setting XmNindicatorOn to False and
  4905. XmNshadowThickness to 2.
  4906.  
  4907. thanks to Ken Lee, klee@synoptics.com ----------
  4908. -------------------------------------------------------------------
  4909. Subject: 139)+ How do I obtain the size of a unmanaged shell widget?
  4910.  
  4911. Answer: In the code below, use getsize() for widgets which have been managed,
  4912. and getsize2() for newly created shell widgets which have not yet been
  4913. managed.
  4914.  
  4915. getsize2() takes two widget parameters because popup dialogs etc.  _consist_
  4916. of two separate widgets - the parent shell and the child bulletin board, form,
  4917. whatever.  This important distinction (somewhat glossed over in the Motif
  4918. manuals) is the cause of a large number of queries in comp.windows.x.motif.
  4919. XmCreate...Dialog() functions return the (bulletin board, form, whatever)
  4920. _child_ of the pair, not the parent shell.
  4921.  
  4922. getsize2() takes the _shell_ widget as it's first parameter, and the shell's
  4923. _child_ (the bulletin board, form, whatever) as it's second.  Thus, if you are
  4924. using code like widget = XmCreate...Dialog() to create your popup dialogs, use
  4925. code like getsize2(XtParent(widget),widget,&width,&height) to get the width
  4926. and height. If you use e.g. XmCreateDialogShell() or XtCreatePopupShell(),
  4927. then you are creating the the shell widget and it's child explicitly, and can
  4928. just pass them into getsize2() with no problem.
  4929.  
  4930. Note: getsize2() calls getsize().
  4931.  
  4932. /* getsize(widget,width,height);
  4933.  * Widget widget;
  4934.  * int *width,*height;
  4935.  *
  4936.  * returns the width and height of a managed widget */
  4937.  
  4938.  
  4939.  
  4940.  
  4941. void getsize(l,w,h) Widget l; int *w,*h; { Dimension w_,h_,b_;
  4942.  
  4943. static Arg size_args[] =
  4944.   {
  4945.   { XmNwidth,0 },
  4946.   { XmNheight,0 },
  4947.   { XmNborderWidth,0 },
  4948.   };
  4949.  
  4950. size_args[0].value = (XtArgVal)&w_; size_args[1].value = (XtArgVal)&h_;
  4951. size_args[2].value = (XtArgVal)&b_;
  4952.  
  4953. XtGetValues(l,size_args,3);
  4954.  
  4955. if (w) *w = w_ + b_; if (h) *h = h_ + b_; } /*
  4956. getsize2(shell,child,width,height);
  4957.  * Widget shell,child;
  4958.  * int *width,*height;
  4959.  *
  4960.  * returns the width, height of an unmanaged shell widget */
  4961.  
  4962. void getsize2(p,c,w,h) Widget p,c; int *w,*h; { XtSetMappedWhenManaged(p,0);
  4963.  
  4964. XtManageChild(c);
  4965.  
  4966. getsize(p,w,h);
  4967.  
  4968. XtUnmanageChild(c);
  4969.  
  4970. XtSetMappedWhenManaged(p,-1); } submitted by: [ Huw Rogers  Communications
  4971. Software Engineer, NEC Corporation, Tokyo, Japan ] [ Email:
  4972. rogersh@ccs.mt.nec.co.jp  Fax: +81-3-5476-1005  Tel: +81-3-5476-1096 ]
  4973.  
  4974. -----------------------------------------------------------------------------
  4975. Subject: 140)  Can I use XtAddTimeOut(), XtAddWorkProc(), and XtAddInput()
  4976. with XtAppMainLoop()?
  4977.  
  4978. Answer: On many systems, the obsolete XtAdd*() functions are not compatible
  4979. with the XtAppMainLoop().  Instead, you should use newer XtAppAddTimeOut(),
  4980. XtAppAddWorkProc(), and XtAppAddInput() functions with XtAppMainLoop()
  4981.  
  4982. thanks to Ken Lee, klee@synoptics.com ----------
  4983. -------------------------------------------------------------------
  4984. Subject: 141)  Why does XtGetValues() XmNx and XmNwidth return extremely large
  4985. values.
  4986.  
  4987. Answer: You must use the 16 bit "Dimension" and "Position" data types for your
  4988. arguments.  If you use 32 bit integers, some implementations will fill the
  4989. remaining 16 bits with invalid data, causing incorrect return values.  The
  4990. *Motif Programmer's Manual* and the widget man pages specify the correct data
  4991. type for each resource.
  4992.  
  4993. thanks to Ken Lee, klee@synoptics.com ----------
  4994. -------------------------------------------------------------------
  4995. Subject: 142)  Can I specify callback functions in resource files?
  4996.  
  4997. Answer: To specify callbacks, you must use UIL in addition to or in place of
  4998. resource files.  You can, however, specify translations in resource files,
  4999. which give you most of the same functionality as callback functions.
  5000.  
  5001. thanks to Ken Lee, klee@synoptics.com ----------
  5002. -------------------------------------------------------------------
  5003. Subject: 143)  How do I specify a search path for ".uid" files?  Answer: Use
  5004. the UIDPATH environment variable.  It is documented on the MrmOpenHierarchy()
  5005. man page.
  5006.  
  5007. -----------------------------------------------------------------------------
  5008. Subject: 144)  XtGetValues() on XmNx and XmNy of my top level shell don't
  5009. return the correct root window coordinates.  How do I compute these?
  5010.  
  5011. Answer: XmNx and XmNy are the coordinates relative to your shell's parent
  5012. window, which is usually a window manager's frame window.  To translate to the
  5013. root coordinate space, use XtTranslateCoords() or XTranslateCoordinates().
  5014.  
  5015. thanks to Ken Lee, klee@synoptics.com ----------
  5016. -------------------------------------------------------------------
  5017. Subject: 145)  Can I use XmGetPixmap() with widgets that have non-default
  5018. visual types?
  5019.  
  5020. Answer: If you're using a different depth, use XmGetPixmapByDepth() instead.
  5021.  
  5022.  thanks to Ken Lee, klee@synoptics.com ----------
  5023. -------------------------------------------------------------------
  5024. Subject: 146)  How can I determine the item selected in a option menu or a
  5025. RadioBox?
  5026.  
  5027. Answer: The value of the XmNmenuHistory resource of the XmRowColumn parent is
  5028. the widget ID of the last selected item.  It works the same way for all menus
  5029. and radio boxes.  thanks to Ken Lee, klee@synoptics.com
  5030.  
  5031. -----------------------------------------------------------------------------
  5032. Subject: 147)  What is the matter with Frame in Motif 1.2?
  5033.  
  5034. [Last modified: November 92]
  5035.  
  5036. Answer: This announcement has been made by OSF:
  5037.  
  5038. "IMPORTANT NOTICE
  5039.  
  5040. We have discovered two problems in the new 1.2 child alignment resources in
  5041. XmFrame. Because some vendors may have committed, or are soon to commit to
  5042. field releases of Motif 1.2 and 1.2.1, OSF's options for fixing them are
  5043. limited. We are trying to deal with these in a way that does not cause
  5044. hardship for application developers who will develop applications against
  5045. various point versions of Motif. OSF's future actions for correction are
  5046. summarized.
  5047.  
  5048. WHAT YOU SHOULD DO AND KNOW
  5049.  
  5050. 1. Mark the following change in your documentation.
  5051.  
  5052. On page 1-512 of the OSF/Motif Programmer's Reference, change the descriptions
  5053. under XmNchildVerticalAlignment as follows (what follows is the CORRECT
  5054. wording to match the current implementation):
  5055.  
  5056. XmALIGNMENT_WIDGET_TOP
  5057.         Causes the BOTTOM edge of the title area to align
  5058.         vertically with the top shadow of the Frame.
  5059.  
  5060. XmALIGNMENT_WIDGET_BOTTOM
  5061.         Causes the TOP edge of the title area to align
  5062.         vertically with the top shadow of the Frame.
  5063.  
  5064. 2. Note the following limitation on resource converters for Motif 1.2 and
  5065. 1.2.1 implementations.
  5066.  
  5067. The rep types for XmFrame's XmNentryVerticalAlignment resource were
  5068. incorrected implemented, which means that converters will not work properly.
  5069. The following resource settings will not work from a resource file in 1.2 and
  5070. 1.2.1:
  5071.  
  5072.         *childVerticalAlignment: alignment_baseline_bottom
  5073.         *childVerticalAlignment: alignment_baseline_top
  5074.         *childVerticalAlignment: alignment_widget_bottom
  5075.         *childVerticalAlignment: alignment_widget_top
  5076.  
  5077. If you wish to set these values for these resources (note they are new
  5078. rces in XmFrame) you will have to set them directly in C or
  5079. via uil.
  5080.  
  5081. WHAT WE WILL DO
  5082.  
  5083. The problem described in note #1 above will not be fixed in the OSF/Motif
  5084. implementation until the next MAJOR release of Motif.  At that time we will
  5085. correct the documentation and modify the code to match those new descriptions,
  5086. but we will preserve the existing enumerated values and their behavior for
  5087. backward compatibility for that release.
  5088.  
  5089. The fix for the problem described in note #2 will be shipped by OSF in Motif
  5090. 1.2.2.
  5091.  
  5092. SUMMARY
  5093.  
  5094. We are sorry for any difficulty this causes Motif users.  If you have any
  5095. questions or flames (I suppose I deserve it) please send them directly to me.
  5096. We sincerely hope this proactive response is better for our customers than you
  5097. having to figure it out yourselves!
  5098.  
  5099. Libby
  5100.  
  5101.  
  5102. -----------------------------------------------------------------------------
  5103. Subject: 148)  What is IMUG and how do I join it?
  5104.  
  5105. Answer: IMUG is the International Motif User Group founded by Quest Windows
  5106. Corporation and co-sponsored by FedUNIX.  IMUG is a non-profit organization
  5107. working to keep users informed on technical and standards issues, to
  5108. strengthen user groups on a local level, to increase communication among users
  5109. internationally, and to promote the use of an international conference as a
  5110. forum for sharing and learning more about Motif.  You can join it by
  5111.  
  5112.  1.  Pay the annual membership fee of $20 USD directly to IMUG.  Contact
  5113.  
  5114.      IMUG
  5115.      5200 Great America Parkway
  5116.      Santa Clara,  CA  95054
  5117.      (408) 496-1900
  5118.      imug@quest.com
  5119.  
  5120.  2.  Register at the International Motif User Conference, and automatically
  5121.      become an IMUG member.
  5122.  
  5123.  3.  Donate a pd widget, widget tool or widget builder to the IMUG Widget
  5124.      Depository and receive a free one year IMUG membership.
  5125.  
  5126.  
  5127. -----------------------------------------------------------------------------
  5128. Subject: 149)  What is the X Professional Organization
  5129.  
  5130. [Last modified: JAN 02 1994]
  5131.  
  5132. Answer: The X Professional Organization's (XPO) purpose is to provide service
  5133. to the X community.  It will serve as an information conduit for professional
  5134. users of X.  XPO will participate in X activities, and help keep its members
  5135. informed on X related issues.
  5136.  
  5137. http://
  5138. In addition to the communication that professional organizations offer, XPO
  5139. provides these other benefits to members:
  5140.  
  5141.     * subscription to the The X Resource, a quarterly publication
  5142.       by O'Reilly & Associates, Inc.,
  5143.  
  5144.     * discounts on X related products, 20% off most new books
  5145.  
  5146. *** For a sample issue of the newsletter,
  5147. *** email  XPO@DELPHI.COM and include your surface address:
  5148.  
  5149.     * the XPO quarterly newsletter featuring:
  5150.          o highlights of conference activities,
  5151.          o new product information,
  5152.          o articles highlighting the latest innovations in X,
  5153.          o feedback from developers and users of X,
  5154.          o calendar of activities,
  5155.          o forum for X professionals to interact and learn,
  5156.          o and much more...
  5157.  
  5158. Membership Information:
  5159. Annual pricing information in US dollars.
  5160.  
  5161. Associate:  Quarterly newsletter
  5162. Regular: Quarterly newsletter + subscription to The X Resource
  5163. Special: Regular + The X Resource  supplemental issues
  5164.  
  5165. Country               Associate    Regular     Special
  5166. USA                     $35.00     $100.00     $120.00
  5167. Canada & Mexico         $40.00     $105.00     $135.00
  5168. Europe & Africa         $45.00     $125.00     $175.00
  5169. Asia & Australia        $50.00     $130.00     $185.00
  5170.  
  5171.  
  5172. Contact:  X Professional Organization, Post Office Box 78, Beltsville,
  5173. Maryland, 20704  USA
  5174.  
  5175. phone: (301) 681 - 2230
  5176. fax:   (410) 465 - 9918, email: XPO@DELPHI.COM
  5177.  
  5178. <A HREF= "http://nearnet.gnn.com/gnn/meta/internet/mkt/xpo/profile.html" XPO Company profile </a>
  5179.  
  5180.  
  5181. -----------------------------------------------------------------------------
  5182. Subject: 150)  How do I set the title of a top level window?
  5183.  
  5184. [Last modified: September 92]
  5185.  
  5186. Answer: Set XmNtitle (and optionally XmNtitleEncoding) for TopLevelShells.
  5187. (Note that this is of type String rather than XmStrin.) Ypu can also set
  5188. XmNiconName if you want its icon to show this title.  For XmDialogShells, set
  5189. the XmNdialogTitle of its immediate child, assuming it's a BulletinBoard
  5190. subclass.  These can also be set in resource files.
  5191.  
  5192.  
  5193. -----------------------------------------------------------------------------
  5194. Subject: 151)  Can I use editres with Motif?
  5195. [Last modified: January 93]
  5196.  
  5197. Answer: It isn't built in to Motif (at 1.2.0), but you can do this in your
  5198. application
  5199.  
  5200.     extern void _XEditResCheckMessages();
  5201.     ...
  5202.     XtAddEventHandler(shell_widget, (EventMask)0, True,
  5203.                         _XEditResCheckMessages, NULL);
  5204.  
  5205. once for each shell widget that you want to react to the "click to select
  5206. client" protocol.  Then link your client with the R5 libXmu.
  5207.  
  5208. David Brooks, OSF
  5209.  
  5210. From Marc Quinton (quinton@stna7.stna7.stna.dgac.fr):
  5211.  
  5212. With X11R4 see the Editres package which is a port of the X11R5 Editres
  5213. protocol and client. You can find it at :
  5214.  
  5215.  ftp.stna7.stna.dgac.fr(143.196.9.83):/pub/dist/Editres.tar.Z
  5216.  
  5217. -----------------------------------------------------------------------------
  5218. Subject: 152)  How can I put decorations on transient windows using olwm?
  5219.  
  5220. Answer: From Jean-Philippe Martin-Flatin <syj@ecmwf.co.uk>
  5221.  
  5222. /**********************************************************************
  5223. ** WindowDecorations.c
  5224. **
  5225. ** Manages window decorations under the OpenLook window manager (OLWM).
  5226. **
  5227. ** Adapted from a C++ program posted to comp.windows.x.motif by:
  5228. **
  5229. **    +--------------------------------------------------------------+
  5230. **    | Ron Edmark                          User Interface Group     |
  5231. **    | Tel:        (408) 980-1500 x282     Integrated Systems, Inc. |
  5232. **    | Internet:   edmark@isi.com          3260 Jay St.             |
  5233. **    | Voice mail: (408) 980-1590 x282     Santa Clara, CA 95054    |
  5234. **    +--------------------------------------------------------------+
  5235. ***********************************************************************/
  5236.  
  5237. #include <X11/X.h>
  5238. #include <X11/Xlib.h>
  5239. #include <X11/Xatom.h>
  5240. #include <X11/Intrinsic.h>
  5241. #include <X11/StringDefs.h>
  5242. #include <X11/Protocols.h>
  5243. #include <Xm/Xm.h>
  5244. #include <Xm/AtomMgr.h>
  5245.  
  5246. /*
  5247. ** Decorations for OpenLook:
  5248. ** The caller can OR different mask options to change the frame decoration.
  5249. */
  5250. #define OLWM_Header     (long)(1<<0)
  5251. #define OLWM_Resize     (long)(1<<1)
  5252. #define OLWM_Close      (long)(1<<2)
  5253.  
  5254. /*
  5255. ** Prototypes
  5256. */
  5257. static void InstallOLWMAtoms  (Widget w);
  5258. static void AddOLWMDialogFrame(Widget widget, long decorationMask);
  5259.  
  5260.  
  5261. /*
  5262. ** Global variables
  5263. */
  5264. static Atom AtomWinAttr;
  5265. static Atom AtomWTOther;
  5266. static Atom AtomDecor;
  5267. static Atom AtomResize;
  5268. static Atom AtomHeader;
  5269. static Atom AtomClose;
  5270. static int  not_installed_yet = TRUE;
  5271.  
  5272.  
  5273. static void InstallOLWMAtoms(Widget w)
  5274. {
  5275.         AtomWinAttr = XInternAtom(XtDisplay(w), "_OL_WIN_ATTR" ,    FALSE);
  5276.         AtomWTOther = XInternAtom(XtDisplay(w), "_OL_WT_OTHER",     FALSE);
  5277.         AtomDecor   = XInternAtom(XtDisplay(w), "_OL_DECOR_ADD",    FALSE);
  5278.         AtomResize  = XInternAtom(XtDisplay(w), "_OL_DECOR_RESIZE", FALSE);
  5279.         AtomHeader  = XInternAtom(XtDisplay(w), "_OL_DECOR_HEADER", FALSE);
  5280.         AtomClose   = XInternAtom(XtDisplay(w), "_OL_DECOR_CLOSE",  FALSE);
  5281.  
  5282.         not_installed_yet = FALSE;
  5283. }
  5284.  
  5285. static void AddOLWMDialogFrame(Widget widget, long decorationMask)
  5286. {
  5287.         Atom   winAttrs[2];
  5288.         Atom   winDecor[3];
  5289.         Widget shell = widget;
  5290.         Window win;
  5291.         int    numberOfDecorations = 0;
  5292.  
  5293.         /*
  5294.         ** Make sure atoms for OpenLook are installed only once
  5295.         */
  5296.         if (not_installed_yet) InstallOLWMAtoms(widget);
  5297.  
  5298.         while (!XtIsShell(shell)) shell = XtParent(shell);
  5299.  
  5300.         win = XtWindow(shell);
  5301.  
  5302.         /*
  5303.         ** Tell Open Look that our window is not one of the standard OLWM window        ** types. See OLIT Widget Set Programmer's Guide pp.70-73.
  5304.         */
  5305.  
  5306.         winAttrs[0] = AtomWTOther;
  5307.  
  5308.         XChangeProperty(XtDisplay(shell),
  5309.                         win,
  5310.                         AtomWinAttr,
  5311.                         XA_ATOM,
  5312.                         32,
  5313.      ce,
  5314.                         (unsigned char*)winAttrs,
  5315.                         1);
  5316.  
  5317.         /*
  5318.         ** Tell Open Look to add some decorations to our window
  5319.         */
  5320.         numberOfDecorations = 0;
  5321.         if (decorationMask & OLWM_Header)
  5322.                 winDecor[numberOfDecorations++] = AtomHeader;
  5323.         if (decorationMask & OLWM_Resize)
  5324.                 winDecor[numberOfDecorations++] = AtomResize;
  5325.         if (decorationMask & OLWM_Close)
  5326.         {
  5327.                 winDecor[numberOfDecorations++] = AtomClose;
  5328.  
  5329.                 /*
  5330.                 ** If the close button is specified, the header must be
  5331.                 ** specified. If the header bit is not set, set it.
  5332.                 */
  5333.                 if (!(decorationMask & OLWM_Header))
  5334.                         winDecor[numberOfDecorations++] = AtomHeader;
  5335.         }
  5336.  
  5337.         XChangeProperty(XtDisplay(shell),
  5338.                         win,
  5339.                         AtomDecor,
  5340.                         XA_ATOM,
  5341.                         32,
  5342.                         PropModeReplace,
  5343.                         (unsigned char*)winDecor,
  5344.                         numberOfDecorations);
  5345. }
  5346.  
  5347.  
  5348. /*
  5349. ** Example of use of AddOLWMDialogFrame, with a bit of extra stuff
  5350. */
  5351. void register_dialog_to_WM(Widget shell, XtCallbackProc Cbk_func)
  5352. {
  5353.         Atom atom;
  5354.  
  5355.         /*
  5356.         ** Alias the "Close" item in system menu attached to dialog shell
  5357.         ** to the activate callback of "Exit" in the menubar
  5358.         */
  5359.         if (Cbk_func)
  5360.         {
  5361.             atom = XmInternAtom(XtDisplay(shell),"WM_DELETE_WINDOW",TRUE);
  5362.             XmAddWMProtocolCallback(shell,atom, Cbk_func,NULL);
  5363.         }
  5364.  
  5365.         /*
  5366.         ** If Motif is the window manager, skip OpenLook specific stuff
  5367.         */
  5368.         if (XmIsMotifWMRunning(shell)) return;
  5369.  
  5370.         /*
  5371.         ** Register dialog shell to OpenLook.
  5372.         **
  5373.         ** WARNING: on some systems, adding the "Close" button allows the title
  5374.         ** to be properly centered in the title bar. On others, activating
  5375.         ** "Close" crashes OpenLook. The reason is not clear yet, but it seems
  5376.         ** the first case occurs with OpenWindows 2 while the second occurs with
  5377.         ** Openwindows 3. Thus, comment out one of the two following lines as
  5378.         ** suitable for your site, and send e-mail to syj@ecmwf.co.uk if you
  5379.         ** find out what is going on !
  5380.         */
  5381.         AddOLWMDialogFrame(shell,(OLWM_Header | OLWM_Resize));
  5382. /*      AddOLWMDialogFrame(shell,(OLWM_Header | OLWM_Resize | OLWM_Close)); */
  5383. }
  5384.  
  5385.  
  5386. -----------------------------------------------------------------------------
  5387. Subject: 153)  Why does an augment translation appear to act as replace for
  5388. some widgets?  When I use either augment or override translations in
  5389. .Xdefaults it seems to act as replace in both Motif 1.0 and 1.1
  5390.  
  5391. Answer: By default, the translation table is NULL.  If there is nothing
  5392. specified (either in resource file, or in args), the widget's Initialize
  5393. finds: Oh, there is NULL in translations, lets use our default ones.  If,
  5394. however, the translations have become non-NULL, the default translations are
  5395. NOT used at all. Thus, using #augment, #override or a new table has identical
  5396. effect: defines the new translations. The only way you can augment/override
  5397. Motif's default translations is AFTER Initialize, using XtSetValues.  Note,
  5398. however, that Motif managers do play with translation tables as well ... so
  5399. that results are not always easy to predict.
  5400.  
  5401. From OSF: A number of people have complained about not being able to
  5402. augment/override translations from the .Xdefaults.  This is due to the
  5403. complexity of the menu system/keyboard traversal and the necessary
  5404. translations changes required to support the Motif Style Guide in menus.  It
  5405. cannot be fixed in a simple way. Fixing it requires re-design of the
  5406. menus/buttons and it is planned to be fixed in 1.2.
  5407.  
  5408.  
  5409.  
  5410.  
  5411.  
  5412. -----------------------------------------------------------------------------
  5413. Subject: 154)  How do you "grey" out a widget so that it cannot be activated?
  5414.  
  5415. Answer: Use XtSetSensitive(widget, False). Do not set the XmNsensitive
  5416. resource directly yourself (by XtSetValues) since the widget may need to talk
  5417. to parents first.
  5418.  
  5419.  
  5420. -----------------------------------------------------------------------------
  5421. Subject: 155)  Why doesn't the Help callback work on some widgets?
  5422.  
  5423. Answer: If you press the help key the help callback of the widget with the
  5424. keyboard focus is called (not the one containing the mouse).  You can't get
  5425. the help callback of a non-keyboard-selectable widget called. To get `context
  5426. sensitive' help on these, you have to find the mouse, associate its position
  5427. with a widget and then do the help.
  5428.  
  5429.  The X Resource, Issue 6, has an article on implementing context help in
  5430.  Motif in this manner, that is, using the mouse position to indicate the
  5431.  widget for which context help is desired, as well as using resources to
  5432.  specify the help.  Example source code is available at
  5433.  
  5434.          ftp.uu.net:/published/oreilly/xresource/helpdemo.tar.Z
  5435.  
  5436.  The demo program lets you toggle between using the method described in
  5437.  the article and XmTrackingLocate() for comparision purposes.
  5438.  
  5439. contributed by: Jay Schmidgall  jay@vnet.ibm.com (author of the article
  5440. mentioned above) --
  5441.  
  5442.  
  5443.  
  5444. -----------------------------------------------------------------------------
  5445. Subject: 156)  Where can I get a Table widget?
  5446.  
  5447. [Last modified: December 92]
  5448.  
  5449. Answer: Send email to Kee Hinckley (nazgul@alfalfa.com) asking for a copy of
  5450. his table widget.  The Widget Creation Library also has one.  See under Motif
  5451. prototyping tools for the contact.
  5452.  
  5453. Expert Database Systems, Inc., 377 Rector Place, Suite 3L New York, NY 10280.
  5454. Phone: (212) 783-6981 has a very comprehensive table widget that uses both
  5455. motif scrollbars or a "virtual" scrollbar showing a miniature version of the
  5456. entire spreadsheet. Allows for different width columns, changing colors in
  5457. each cell.  Only one X-Window is used so as to reduce the amount of system
  5458. resources used.  Contact Ken Jones email: ken@mr_magoo.sbi.com)
  5459.  
  5460.  
  5461. -----------------------------------------------------------------------------
  5462. Subject: 157)  Has anyone done a bar graph widget?
  5463. [Last modified: September 92]
  5464.  
  5465. Answer: You can fake one by using for each bar a scroll bar or even a label
  5466. which changes in size, put inside a container of some kind.
  5467.  
  5468. Try the StripChart widget in the Athena widget set. Set the XtNupdate resource
  5469. to 0 to keep it from automatically updating.
  5470.  
  5471. The comp.windows.x FAQ mentions a bar graph widget.
  5472.  
  5473. Expert Database Systems, Inc.  sells a bar graph widget as well as a multi-
  5474. line graph with automatic scaling, a 3-D surface graph, and a high/Low graph
  5475. with two lines for moving averages.  Contact Ken Jones Expert Database
  5476. Systems, Inc., 377 Rector Place, Suite 3L New York, NY 10280.  Phone: (212)
  5477. 783-6981
  5478.  
  5479.  
  5480. The Xtra XWidget library contains a set of widgets that are subclassed from
  5481. and compatible with either OSF/Motif or OLIT widgets.  The library includes
  5482. widgets that implement the following:
  5483.  
  5484.    Spreadsheet
  5485.    Bar Graph
  5486.    Stacked Bar Graph
  5487.    Line Graph
  5488.    Pie Chart
  5489.    XY Plot
  5490.    Hypertext
  5491.    Hypertext based Help System
  5492.    Entry Form with type checking
  5493.  
  5494. Contact Graphical Software Technology at 310-328-9338  (info@gst.com) for
  5495. information.
  5496.  
  5497. The XRT/graph widget, available for Motif, XView and OLIT, displays X-Y plots,
  5498. bar and pie charts, and supports user-feedback, fast updates and PostScript
  5499. output. Contact KL Group Inc. at 416-594-1026 (xrt_info%klg@uunet.ca)
  5500.  
  5501. The product Xmath, made by Integrated Systems Inc. is a product which has
  5502. interactive 2d and 3d graphics for bar,strip,line,symbol,
  5503. surface,contour,etc... that costs $2500.00 for commercial use and a mere
  5504. $250.00 for university use that also has complete numerics capabilities, an
  5505. easy to use debugger, a complete high level language, a spreadsheet, a motif
  5506. gui access capability, and much more all created on top of motif.
  5507.  
  5508. You can either email to xmath-info@isi.com or call (408)980-1500.
  5509.  
  5510. Digital Equipment Corporation (DEC) provides the following product NetEd: "The
  5511. network editor widget is a Motif toolkit conforming widget that applications
  5512. aphically in the form of
  5513. networks or graphs. The network editor supports interactive or application-
  5514. controlled creation and editing of directed graphs or networks."
  5515.  
  5516.  
  5517. ACE/gr is an X based XY plotting tool implemented with a point 'n click
  5518. paradigm.  A few of its features are:
  5519.  
  5520.    * Plots up to 10 graphs with 30 data sets per graph.
  5521.    * Data read from files and/or pipes.
  5522.    * Graph types XY, log-linear, linear-log, log-log, bar,
  5523.         stacked bar charts.
  5524.  
  5525. it is available from
  5526.  
  5527.         ftp.ccalmr.ogi.edu (presently amb4.ccalmr.ogi.edu)
  5528.  
  5529. with IP address 129.95.72.34. The XView version (xvgr) will be found in
  5530. /CCALMR/pub/acegr/xvgr-2.09.tar.Z and the Motif version (xmgr) in
  5531. /CCALMR/pub/acegr/xmgr-2.09.tar.Z.  Comments, suggestions, bug reports to
  5532. pturner@amb4.ccalmr.ogi.edu (if mail fails, try pturner@ese.ogi.edu). Due to
  5533. time constraints, replies will be few and far between.
  5534.  
  5535.  
  5536.  
  5537. -----------------------------------------------------------------------------
  5538. Subject: 158)  Does anyone know of a source code of a graph widget where you
  5539. can add vertices and edges and get an automated updating?
  5540.  
  5541. [Last modified: March 93]
  5542.  
  5543. Answer: The XUG FAQ in comp.windows.x includes information on graph display
  5544. widgets.  There is also an implementation in the Asente/Swick book.
  5545.  
  5546.   From Martin Janzen: "You could have a look at DataViews, from V.I.
  5547.    Corporation.  This package is used mainly to display a variety of graph
  5548.    drawings (eg. bar, line, pie, high/low, and other charts), and to update
  5549.    the graphs as information is received from "data sources" such as files,
  5550.    processes (through pipes), or devices.
  5551.  
  5552.    However, it also provides "node" and "edge" objects which can be used
  5553.    when working with network graphs.  The DV-Tools function library
  5554.    provides routines which traverse a graph, count visits to each node or
  5555.    edge, mark nodes or edges of interest, and so on.  A node or edge object
  5556.    can have an associated "geometry object" (such as a symbol or a line),
  5557.    which represents that node or edge.
  5558.  
  5559.    Drawbacks: There's no automatic positioning algorithm; when you add a
  5560.    node or edge, you have to create and position its geometry object
  5561.    yourself.  Also, this isn't a set of add-on widgets; you can either have
  5562.    DataViews create an X window (ie. a separate shell), or you can create
  5563.    your own XmDrawingArea and use DataViews to update its window when
  5564.    expose events are received.  Finally, the package is quite expensive,
  5565.    and there is a run-time charge.
  5566.  
  5567.    The vendor's address is:
  5568.      V.I. Corporation,
  5569.      47 Pleasant Street,
  5570.      Northampton, MA  01060,
  5571.             Email: vi@vicorp.com, Phone: (413) 586-4144, Fax:   (413) 584-2649
  5572.  
  5573.    or
  5574.  
  5575.      V.I. Corporation (Europe) Ltd.,
  5576.      First Base, Beacontree Plaza,
  5577.      Gillette Way,                      Email: viesales@eurovi.uucp
  5578.      Reading, Berkshire  RG2 0BP"
  5579.    Phone: +44 734 756010,      Fax:   +44 734 756104
  5580.  
  5581. From Craig Timmerman: Just wanted others to know that there is a third
  5582. competitor in what may be come a big market for generic APIs.  The product is
  5583. called Open Interface and Neuron Data is the vendor.  Neuron has added some
  5584. extra, more complex widgets to their set.  The two most notable are a table
  5585. and network widget.  [...] I believe that the network widget got its name from
  5586. its ability to display expert system networks that Neuron's AI tools needed.
  5587. It would be more aptly named the graph widget.  It can display and manipulate
  5588. graphs of various types (trees, directed graphs, etc).  Contact is
  5589.  
  5590.         Neuron Data
  5591.         156 University Avenue
  5592.         Palo Alto,  CA  94301
  5593.         (415) 321-4488
  5594.  
  5595.  
  5596. prism!gt3273b@gatech.edu  (RENALDS,ANDREW THEODORE) posted a set of public
  5597. domain routines for graph drawing.  Contact him for a later set.
  5598.  
  5599. From Ramon Santiago (santiago@fgssu1.fgs.slb.com): HP has released source code
  5600. for XmGraph and XmArc, part of the InterWorks library, which does exactly
  5601. this. The sources can be obtained by contacting Dave Shaw,
  5602. librarian@iworks.ecn.uiowa.edu. A few trivial source code changes need to be
  5603. made to get these widgets to compile under Motif 1.2.
  5604.  
  5605. Free DAG - directed acyclic graph drawing software in motif environment is
  5606. available. Please send a note to address below if you want it:
  5607.  
  5608. Budak Arpinar, TUBITAK Software Research & Development Center, Ankara,
  5609. TURKIYE, E-mail : C51881@TRMETU.BITNET
  5610.  
  5611.  
  5612.  
  5613. -----------------------------------------------------------------------------
  5614. Subject: 159)+ Is there a help system available, such as in Windows 3?  Or any
  5615. Motif based hypertext system.
  5616.  
  5617. [Last modified: apr 94]
  5618.  
  5619. Answer:
  5620.  
  5621. HTML Widget from NCSA:
  5622.  
  5623. The NCSA Mosaic for X package contains a html widget which is freely available
  5624. and is the main vehicle for viewing html documents in the Mosaic program. It
  5625. has callbacks for anchor hits, selections, etc and many many resources for
  5626. customizing the viewing area of your hypertext documents.
  5627.  
  5628. GWHIS:
  5629.  
  5630. There is a new product from Quadralay Corporation, called the Global-Wide Help
  5631. & Information Systems (GWHIS).
  5632.  
  5633. from a press release: AUSTIN, TX (March 3, 1994) Quadralay Corporation today
  5634. announced its newest software development tool, Global Wide Help & Information
  5635. System (GWHIS).  GWHIS allows third party application developers to add online
  5636. documentation and context sensitive help to their applications like never
  5637. before.  This documentation may consist of plain text, rich format text,
  5638. hypertext, images, audio, and/or video animation and may easily be distributed
  5639. either locally or over a wide area network such as the Internet.
  5640.  
  5641. GWHIS consists of two primary components.  An application programming
  5642. interface (API), and a hypermedia viewer (based on technology licensed from
  5643. the NCSA Mosaic project).  Several ancillary conversion programs are also
  5644. available allowing end users to easily convert existing documentation into
  5645. GWHIS' native HTML format.
  5646.  
  5647. GWHIS is available on the following platforms: SPARC SunOS 4.1.x, SPARC
  5648. Solaris 2.x, INTEL SCO Open Desktop, INTEL Solaris 2.x, HP 9000/700, and the
  5649. RS/6000. Support for additional platforms (including MS Windows and Macintosh)
  5650. is under consideration.  Fully functional evaluation copies of this software
  5651. are available upon request or via anonymous ftp from ftp.quadralay.com.
  5652.  
  5653. Brian Combs Quadralay Corporation combs@quadralay.com
  5654.  
  5655.  
  5656.  
  5657. Bristol Technology have a hypertext system HyperHelp with the look-and-feel of
  5658. either Motif or OpenLook. It should be available from january 31, 1992.
  5659. Contact
  5660.  
  5661.         Bristol Technology Inc.
  5662.         898 Ethan Allen Highway
  5663.         Ridgefield, CT  06877
  5664.         203-438-6969 (phone)
  5665.         203-438-5013 (fax)
  5666.         uunet.uu.net!bristol!keith
  5667.  
  5668. Demos are available by anonymous ftp from  ftp.uu.net (137.39.1.9) in the
  5669. vendor/Bristol/HyperHelp as files sun.motif.tar.Z and hp.tar.Z.
  5670.  
  5671. There was a posting of a motif hypertext-widget to comp.sources.x (Author:
  5672. B.Raoult ( mab@ecmwf.co.uk ) ).  It had the facility to read in helptext from
  5673. a file.
  5674.  
  5675. From Francois Felix Ingrand (felix@idefix.laas.fr): I have translated the Info
  5676. AW (originally written by Jordan Hubbard) to Motif. It is a Widget to browse
  5677. Info files (format used by GNU for their various documentations). I use it as
  5678. the help system of various tool I wrote.  It is available on laas.laas.fr
  5679. (140.93.0.15) in /pub/prs/xinfo-motif.tar.Z
  5680.  
  5681. Form Scott Raney (raney@metacard.com) MetaCard is a commercial package that
  5682. can be used to implement hypertext help.  The text fields support multiple
  5683. typefaces, sizes, styles, colors, subscript/superscript, and hypertext links.
  5684. It has a Motif interface, and a template for calling it from an Xt/Motif
  5685. application is included.  You can FTP a save-disabled distribution from
  5686. ftp.metacard.com or from world.std.com.  For more info, email to
  5687. info@metacard.com.
  5688.  
  5689.  
  5690. The Motifation GbR also provides a hypertext-helpsystem named 'XpgHelp'.
  5691. (Motif look-and-feel / features like those known from MS Windows Help ) For a
  5692. free demo or more information send email either to griebel@uni-paderborn.d e
  5693. or contact the distributor:
  5694.  
  5695.         PEM GmbH,
  5696.         Vaihinger Strasse 49,
  5697.         7000 Stuttgart 80,
  5698.         Germany,
  5699.         +49 (0) 711 713045 (phone),
  5700.         +49 (0) 711 713047 (fax),
  5701. asien@pem-stuttgart.de
  5702.  
  5703. XpgHelp has nearly the same features like HyperHelp: (multiple fonts, graphics
  5704. in b&w and color, different styles, tabs, links, short links, notepad, ...)
  5705.  
  5706. The Interface Builder MOTIFATION uses XpgHelp as its hypertext helpsystem.
  5707.  
  5708.  
  5709.  
  5710. -----------------------------------------------------------------------------
  5711. Subject: 160)  Can I specify a widget in a resource file?
  5712.  
  5713. Answer: This answer, which uses the Xmu library, is due to David Elliott.  If
  5714. the converter is added, then the name of a widget (a string) can be used in
  5715. resource files, and will be converted to the appropriate widget.
  5716.  
  5717. This code, which was basically stolen from the Athena Form widget, adds a
  5718. String to Widget converter.  I wrote it as a general routine that I call at
  5719. the beginning of all of my programs, and made it so I could add other
  5720. converters as needed (like String to Unit Type ;-).
  5721.  
  5722.         #include <X11/Intrinsic.h>
  5723.         #include <X11/StringDefs.h>
  5724.         #include <Xm/Xm.h>
  5725.         #include <X11/Xmu/Converters.h>
  5726.         #include <X11/IntrinsicP.h>
  5727.         #include <X11/CoreP.h>
  5728.  
  5729.         void
  5730.         setupConverters()
  5731.         {
  5732.                 static XtConvertArgRec parentCvtArgs[] = {
  5733.                         {XtBaseOffset, (caddr_t)XtOffset(Widget, core.parent),
  5734.                                 sizeof(Widget)}
  5735.                 };
  5736.  
  5737.                 XtAddConverter(XmRString, XmRWindow, XmuCvtStringToWidget,
  5738.                         parentCvtArgs, XtNumber(parentCvtArgs));
  5739.         }
  5740.  
  5741.  
  5742.  
  5743. -----------------------------------------------------------------------------
  5744. Subject: 161)  Why are only some of my translations are being installed?  I
  5745. have a translation table like the following, but only the first ones are
  5746. getting installed and the rest are ignored.
  5747.  
  5748.  *Text.translations:    #override \
  5749.      Ctrl<Key>a:    beginning-of-line() \n\
  5750.      Ctrl<Key>e:    end-of-line() \n\
  5751.      Ctrl<Key>f:    forward-character() \n\
  5752.  
  5753.  
  5754. Answer: Most likely, you have a space at the end of one of the lines (the
  5755. first in this case).
  5756.  
  5757.      Ctrl<Key>a:    beginning-of-line() \n\
  5758.                                            ^ space here
  5759.  
  5760. The second backslash in each line is there to protect the real newline
  5761. character and so you must not follow it with anything other than the newline
  5762. itself. Otherwise it acts as the end of the resource definition and the
  5763. remaining lines are not added.
  5764.  
  5765.  
  5766. -----------------------------------------------------------------------------
  5767. Subject: 162)  Where can I get the PanHandler code?
  5768.  
  5769. Answer: It is available by email from Chuck Ocheret:  chuck@IMSI.COM.
  5770.  
  5771. -----------------------------------------------------------------------------
  5772. Subject: 163)  What are these passive grab warnings?  When I destroy certain
  5773. widgets I get a stream of messages
  5774.  
  5775.     Warning: Attempt to remove non-existant passive grab
  5776.  
  5777.  
  5778. Answer: They are meaningless, and you want to ignore them.  Do this (from Kee
  5779. Hinckley) by installing an XtWarning handler that explicitly looks for them
  5780. and discards them:
  5781.  
  5782.         static void xtWarnCB(String message) {
  5783.            if (asi_strstr(message, "non-existant passive grab", TRUE)) return;
  5784.            ...
  5785.  
  5786. They come from Xt, and (W. Scott Meeks): "it's something that the designers of
  5787. Xt decided the toolkit should do. Unfortunately, Motif winds up putting
  5788. passive grabs all over the place for the menu system.  On the one hand, we
  5789. want to remove all these grabs when menus get destroyed so that they don't
  5790. leak memory; on the other hand, it's almost impossible to keep track of all
  5791. the grabs, so we have a conservative strategy of ungrabbing any place where a
  5792. grab could have been made and we don't explicitly know that there is no grab.
  5793. The unfortunate side effect is the little passive grab warning messages.
  5794. We're trying to clean these up where possible, but there are some new places
  5795. where the warning is generated.  Until we get this completely cleaned up (1.2
  5796. maybe), your best bet is probably to use a warning handler."
  5797.  
  5798. -----------------------------------------------------------------------------
  5799. Subject: 164)  How do I have more buttons than three in a box?  I want to have
  5800. something like a MessageBox (or other widget) with more than three buttons,
  5801. but with the same nice appearance.
  5802.  
  5803. [Last modified: May 93]
  5804.  
  5805. Answer: The Motif 1.2 MessageBox widget allows extra buttons to be added after
  5806. the OK button. Just create the extra buttons as children of the MessageBox.
  5807. Similarly with the SelectionBox.
  5808.  
  5809. Pre-Motif 1.2, you have to do one of the following methods.
  5810.  
  5811. A SelectionBox is created with four buttons, but the fourth (the Apply button)
  5812. is unmanaged. To manage it get its widget ID via
  5813. XmSelectionBoxGetChild(parent, XmDIALOG_APPLY_BUTTON) and then XtManage it.
  5814. Unmanage all of the other bits in the SelectionBox that you don't want.  If
  5815. you want more than four buttons, try two SelectionBoxes (or similar) together
  5816. in a container, where all of the unwanted parts of the widgets are unmanaged.
  5817.  
  5818. Alternatively, build your own dialog:
  5819.  
  5820. /* Written by Dan Heller.  Copyright 1991, O'Reilly && Associates.
  5821.  * This program is freely distributable without licensing fees and
  5822.  * is provided without guarantee or warranty expressed or implied.
  5823.  * This program is -not- in the public domain.  This program is
  5824.  * taken from the Motif Programming Manual, O'Reilly Volume 6.
  5825.  */
  5826.  
  5827. /* action_area.c -- demonstrate how CreateActionArea() can be used
  5828.  * in a real application.  Create what would otherwise be identified
  5829.  * as a PromptDialog, only this is of our own creation.  As such,
  5830.  * we provide a TextField widget for input.  When the user presses
  5831.  * Return, the Ok button is activated.
  5832.  */
  5833. #include <Xm/DialogS.h>
  5834. #include <Xm/PushBG.h>
  5835. #include <Xm/PushB.h>
  5836. #include <Xm/LabelG.h>
  5837. #include <Xm/PanedW.h>
  5838. #include <Xm/Form.h>
  5839. #include <Xm/RowColumn.h>
  5840. #include <Xm/TextF.h>
  5841.  
  5842. typedef struct {
  5843.     char *label;
  5844.     void (*callback)();
  5845.     caddr_t data;
  5846. } ActionAreaItem;
  5847.  
  5848. static void
  5849.     do_dialog(), close_dialog(), activate_cb(),
  5850.     ok_pushed(), cancel_pushed(), help();
  5851.  
  5852. main(argc, argv)
  5853. int argc;
  5854. char *argv[];
  5855. {
  5856.     Widget toplevel, button;
  5857.     XtAppContext app;
  5858.  
  5859.     toplevel = XtVaAppInitialize(&app, "Demos",
  5860.         NULL, 0, &argc, argv, NULL, NULL);
  5861.  
  5862.     button = XtVaCreateManagedWidget("Push Me",
  5863.         xmPushButtonWidgetClass, toplevel, NULL);
  5864.     XtAddCallback(button, XmNactivateCallback, do_dialog, NULL);
  5865.  
  5866.     XtRealizeWidget(toplevel);
  5867.     XtAppMainLoop(app);
  5868. }
  5869.  
  5870. /* callback routine for "Push Me" button.  Actually, this represents
  5871.  * a function that could be invoked by any arbitrary callback.  Here,
  5872.  * we demonstrate how one can build a standard customized dialog box.
  5873.  * The control area is created here and the action area is created in
  5874.  * a separate, generic routine: CreateActionArea().
  5875.  */
  5876. static void
  5877. do_dialog(w, file)
  5878. Widget w; /* will act as dialog's parent */
  5879. char *file;
  5880. {
  5881.     Widget dialog, pane, rc, label, text_w, action_a;
  5882.     XmString string;
  5883.     extern Widget CreateActionArea();
  5884.     Arg args[10];
  5885.     static ActionAreaItem action_items[] = {
  5886.         { "Ok",     ok_pushed,     NULL          },
  5887.         { "Cancel", cancel_pushed, NULL          },
  5888.         { "Close",  close_dialog,  NULL          },
  5889.         { "Help",   help,          "Help Button" },
  5890.     };
  5891.  
  5892.     /* The DialogShell is the Shell for this dialog.  Set it up so
  5893.      * that the "Close" button in the window manager's system menu
  5894.      * destroys the shell (it only unmaps it by default).
  5895.      */
  5896.     dialog = XtVaCreatePopupShell("dialog",
  5897.         xmDialogShellWidgetClass, XtParent(w),
  5898.         XmNtitle,  "Dialog Shell",     /* give arbitrary title in wm */
  5899.         XmNdeleteResponse, XmDESTROY,  /* system menu "Close" action */
  5900.         NULL);
  5901.  
  5902.     /* now that the dialog is created, set the Close button's
  5903.      * client data, so close_dialog() will know what to destroy.
  5904.      */
  5905.     action_items[2].data = (caddr_t)dialog;
  5906.  
  5907.     /* Create the paned window as a child of the dialog.  This will
  5908.      * contain the control area (a Form widget) and the action area
  5909.      * (created by CreateActionArea() using the action_items above).
  5910.      */
  5911.     pane = XtVaCreateWidget("pane", xmPanedWindowWidgetClass, dialog,
  5912.        1,
  5913.         XmNsashHeight, 1,
  5914.         NULL);
  5915.  
  5916.     /* create the control area (Form) which contains a
  5917.      * Label gadget and a List widget.
  5918.      */
  5919.     rc = XtVaCreateWidget("control_area", xmRowColumnWidgetClass, pane, NULL);
  5920.     string = XmStringCreateSimple("Type Something:");
  5921.     XtVaCreateManagedWidget("label", xmLabelGadgetClass, rc,
  5922.         XmNlabelString,    string,
  5923.         XmNleftAttachment, XmATTACH_FORM,
  5924.         XmNtopAttachment,  XmATTACH_FORM,
  5925.         NULL);
  5926.     XmStringFree(string);
  5927.  
  5928.     text_w = XtVaCreateManagedWidget("text-field",
  5929.         xmTextFieldWidgetClass, rc, NULL);
  5930.  
  5931.     /* RowColumn is full -- now manage */
  5932.     XtManageChild(rc);
  5933.  
  5934.     /* Set the client data "Ok" and "Cancel" button's callbacks. */
  5935.     action_items[0].data = (caddr_t)text_w;
  5936.     action_items[1].data = (caddr_t)text_w;
  5937.  
  5938.     /* Create the action area -- we don't need the widget it returns. */
  5939.     action_a = CreateActionArea(pane, action_items, XtNumber(action_items));
  5940.  
  5941.     /* callback for Return in TextField.  Use action_a as client data */
  5942.     XtAddCallback(text_w, XmNactivateCallback, activate_cb, action_a);
  5943.  
  5944.     XtManageChild(pane);
  5945.     XtPopup(dialog, XtGrabNone);
  5946. }
  5947.  
  5948. /*--------------*/
  5949. /* The next four functions are the callback routines for the buttons
  5950.  * in the action area for the dialog created above.  Again, they are
  5951.  * simple examples, yet they demonstrate the fundamental design approach.
  5952.  */
  5953. static void
  5954. close_dialog(w, shell)
  5955. Widget w, shell;
  5956. {
  5957.     XtDestroyWidget(shell);
  5958. }
  5959.  
  5960. /* The "ok" button was pushed or the user pressed Return */
  5961. static void
  5962. ok_pushed(w, text_w, cbs)
  5963. Widget w, text_w;         /* the text widget is the client data */
  5964. XmAnyCallbackStruct *cbs;
  5965. {
  5966.     char *text = XmTextFieldGetString(text_w);
  5967.  
  5968.     printf("String = %s0, text);
  5969.     XtFree(text);
  5970. }
  5971.  
  5972. static void
  5973. cancel_pushed(w, text_w, cbs)
  5974. Widget w, text_w;         /* the text field is the client data */
  5975. XmAnyCallbackStruct *cbs;
  5976. {
  5977.     /* cancel the whole operation; reset to NULL. */
  5978.     XmTextFieldSetString(text_w, "");
  5979. }
  5980.  
  5981. static void
  5982. help(w, string)
  5983. Widget w;
  5984. String string;
  5985. {
  5986.     puts(string);
  5987. }
  5988. /*--------------*/
  5989.  
  5990. /* When Return is pressed in TextField widget, respond by getting
  5991.  * the designated "default button" in the action area and activate
  5992.  * it as if the user had selected it.
  5993.  */
  5994. static void
  5995. activate_cb(text_w, client_data, cbs)
  5996. Widget text_w;              /* user pressed Return in this widget */
  5997. XtPointer client_data;        /* action_area passed as client data */
  5998. XmAnyCallbackStruct *cbs;   /* borrow the "event" field from this */
  5999. {
  6000.     Widget dflt, action_area = (Widget)client_data;
  6001.  
  6002.     XtVaGetValues(action_area, XmNdefaultButton, &dflt, NULL);
  6003.     if (dflt) /* sanity check -- this better work */
  6004.         /* make the default button think it got pushed.  This causes
  6005.          * "ok_pushed" to be called, but XtCallActionProc() causes
  6006.          * the button appear to be activated as if the user selected it.
  6007.          */
  6008.         XtCallActionProc(dflt, "ArmAndActivate", cbs->event, NULL, 0);
  6009. }
  6010.  
  6011. #define TIGHTNESS 20
  6012.  
  6013. Widget
  6014. CreateActionArea(parent, actions, num_actions)
  6015. Widget parent;
  6016. ActionAreaItem *actions;
  6017. int num_actions;
  6018. {
  6019.     Widget action_area, widget;
  6020.     int i;
  6021.  
  6022.     action_area = XtVaCreateWidget("action_area", xmFormWidgetClass, parent,
  6023.         XmNfractionBase, TIGHTNESS*num_actions - 1,
  6024.         XmNleftOffset,   10,
  6025.         XmNrightOffset,  10,
  6026.         NULL);
  6027.  
  6028.     for (i = 0; i < num_actions; i++) {
  6029.         widget = XtVaCreateManagedWidget(actions[i].label,
  6030.             xmPushButtonWidgetClass, action_area,
  6031.             XmNleftAttachment,       i? XmATTACH_POSITION : XmATTACH_FORM,
  6032.             XmNleftPosition,         TIGHTNESS*i,
  6033.             XmNtopAttachment,        XmATTACH_FORM,
  6034.             XmNbottomAttachment,     XmATTACH_FORM,
  6035.             XmNrightAttachment,
  6036.                     i != num_actions-1? XmATTACH_POSITION : XmATTACH_FORM,
  6037.             XmNrightPosition,        TIGHTNESS*i + (TIGHTNESS-1),
  6038.             XmNshowAsDefault,        i == 0,
  6039.             XmNdefaultButtonShadowThickness, 1,
  6040.             NULL);
  6041.         if (actions[i].callback)
  6042.             XtAddCallback(widget, XmNactivateCallback,
  6043.                 actions[i].callback, actions[i].data);
  6044.         if (i == 0) {
  6045.             /* Set the action_area's default button to the first widget
  6046.              * created (or, make the index a parameter to the function
  6047.              * or have it be part of the data structure). Also, set the
  6048.              * pane window constraint for max and min heights so this
  6049.              * particular pane in the PanedWindow is not resizable.
  6050.              */
  6051.             Dimension height, h;
  6052.             XtVaGetValues(action_area, XmNmarginHeight, &h, NULL);
  6053.             XtVaGetValues(widget, XmNheight, &height, NULL);
  6054.             height += 2 * h;
  6055.             XtVaSetValues(action_area,
  6056.                 XmNdefaultButton, widget,
  6057.                 XmNpaneMaximum,   height,
  6058.                 XmNpaneMinimum,   height,
  6059.                 NULL);
  6060.         }
  6061.     }
  6062.  
  6063.     XtManageChild(action_area);
  6064.  
  6065.     return action_area;
  6066. }
  6067.  
  6068.  
  6069.  
  6070. -----------------------------------------------------------------------------
  6071. Subject: 165)  How do I create a "busy working cursor"?
  6072.  
  6073. Answer: - in Baudouin's code (following), the idea is to keep in an array an
  6074. up-to-date list of all shells used in the application, and set for all of them
  6075. the cursor to a watch or to the default cursor, with the 2 functions provided.
  6076.  
  6077. - in Dan Heller's code (later), the idea is to turn on the watch cursor for
  6078. the top-level shell only, popup a working window to possibly abort the
  6079. callback, and manage some expose events during the callback.
  6080.  
  6081. - in the FAQ for comp.windows.x (#113), the idea is to bring a large window on
  6082. top of the application, hide all windows below it, and turn on the watch
  6083. cursor on this large window. Unmapping the large window resets the default
  6084. cursor, mapping it turns on the watch cursor.
  6085.  
  6086. From Baudouin Raoult (mab@ecmwf.co.uk)
  6087.  
  6088. void my_SetWatchCursor(w)
  6089. Widget w;
  6090. {
  6091.         static Cursor watch = NULL;
  6092.  
  6093.         if(!watch)
  6094.                 watch = XCreateFontCursor(XtDisplay(w),XC_watch);
  6095.  
  6096.         XDefineCursor(XtDisplay(w),XtWindow(w),watch);
  6097.         XmUpdateDisplay(w);
  6098. }
  6099.  
  6100. void my_ResetCursor(w)
  6101. Widget w;
  6102. {
  6103.         XUndefineCursor(XtDisplay(w),XtWindow(w));
  6104.         XmUpdateDisplay(w);
  6105. }
  6106.  
  6107.  
  6108. Answer: A solution with lots of bells and whistles is
  6109.  
  6110. /* Written by Dan Heller.  Copyright 1991, O'Reilly && Associates.
  6111.  * This program is freely distributable without licensing fees and
  6112.  * is provided without guarantee or warrantee expressed or implied.
  6113.  * This program is -not- in the public domain.
  6114.  */
  6115.  
  6116. /* busy.c -- demonstrate how to use a WorkingDialog and to process
  6117.  * only "important" events.  e.g., those that may interrupt the
  6118.  * task or to repaint widgets for exposure.  Set up a simple shell
  6119.  * and a widget that, when pressed, immediately goes into its own
  6120.  * loop.  First, "lock" the shell so that a timeout cursor is set on
  6121.  * the shell and pop up a WorkingDialog.  Then enter loop ... sleep
  6122.  * for one second ten times, checking between each interval to see
  6123.  * if the user clicked the Stop button or if any widgets need to be
  6124.  * refreshed.  Ignore all other events.
  6125.  *
  6126.  * main() and get_busy() are stubs that would be replaced by a real
  6127.  * application; all other functions can be used "as is."
  6128.  */
  6129. #include <Xm/MessageB.h>
  6130. #include <Xm/PushB.h>
  6131. #include <X11/cursorfont.h>
  6132.  
  6133. Widget shell;
  6134. void TimeoutCursors();
  6135. Boolean CheckForInterrupt();
  6136.  
  6137. main(argc, argv)
  6138. int argc;
  6139. char *argv[];
  6140. {
  6141.     XtAppContext app;
  6142.     Widget button;
  6143.     XmString label;
  6144.     void get_busy();
  6145.  
  6146.     shell = XtVaAppInitialize(&app, "Demos",
  6147.         NULL, 0, &argc, argv, NULL, NULL);
  6148.  
  6149.     label = XmStringCreateSimple(
  6150.         "Boy, is *this* going to take a long time.");
  6151.     button = XtVaCreateManagedWidget("button",
  6152.         xmPushButtonWidgetClass, shell,
  6153.         XmNlabelString,          label,
  6154.         NULL);
  6155.     XmStringFree(label);
  6156.     XtAddCallback(button, XmNactivateCallback, get_busy, argv[1]);
  6157.  
  6158.     XtRealizeWidget(shell);
  6159.     XtAppMainLoop(app);
  6160. }
  6161.  
  6162. void
  6163. get_busy(widget)
  6164. Widget widget;
  6165. {
  6166.     int n;
  6167.  
  6168.     TimeoutCursors(True, True);
  6169.     for (n = 0; n < 10; n++) {
  6170. ;
  6171.         if (CheckForInterrupt()) {
  6172.             puts("Interrupt!");
  6173.             break;
  6174.         }
  6175.     }
  6176.     if (n == 10)
  6177.         puts("done.");
  6178.     TimeoutCursors(False, NULL);
  6179. }
  6180.  
  6181. /* The interesting part of the program -- extract and use at will */
  6182. static Boolean stopped;  /* True when user wants to stop processing */
  6183. static Widget dialog;    /* WorkingDialog displayed when timed out */
  6184.  
  6185. /* timeout_cursors() turns on the "watch" cursor over the application
  6186.  * to provide feedback for the user that he's going to be waiting
  6187.  * a while before he can interact with the appliation again.
  6188.  */
  6189. void
  6190. TimeoutCursors(on, interruptable)
  6191. int on, interruptable;
  6192. {
  6193.     static int locked;
  6194.     static Cursor cursor;
  6195.     extern Widget shell;
  6196.     XSetWindowAttributes attrs;
  6197.     Display *dpy = XtDisplay(shell);
  6198.     XEvent event;
  6199.     Arg args[1];
  6200.     XmString str;
  6201.     extern void stop();
  6202.  
  6203.     /* "locked" keeps track if we've already called the function.
  6204.      * This allows recursion and is necessary for most situations.
  6205.      */
  6206.     on? locked++ : locked--;
  6207.     if (locked > 1 || locked == 1 && on == 0)
  6208.         return; /* already locked and we're not unlocking */
  6209.  
  6210.     stopped = False; /* doesn't matter at this point; initialize */
  6211.     if (!cursor) /* make sure the timeout cursor is initialized */
  6212.         cursor = XCreateFontCursor(dpy, XC_watch);
  6213.  
  6214.     /* if "on" is true, then turn on watch cursor, otherwise, return
  6215.      * the shell's cursor to normal.
  6216.      */
  6217.     attrs.cursor = on? cursor : None;
  6218.  
  6219.     /* change the main application shell's cursor to be the timeout
  6220.      * cursor (or to reset it to normal).  If other shells exist in
  6221.      * this application, they will have to be listed here in order
  6222.      * for them to have timeout cursors too.
  6223.      */
  6224.     XChangeWindowAttributes(dpy, XtWindow(shell), CWCursor, &attrs);
  6225.  
  6226.     XFlush(dpy);
  6227.  
  6228.     if (on) {
  6229.         /* we're timing out, put up a WorkingDialog.  If the process
  6230.          * is interruptable, allow a "Stop" button.  Otherwise, remove
  6231.          * all actions so the user can't stop the processing.
  6232.          */
  6233.         str = XmStringCreateSimple("Busy.  Please Wait.");
  6234.         XtSetArg(args[0], XmNmessageString, str);
  6235.         dialog = XmCreateWorkingDialog(shell, "Busy", args, 1);
  6236.         XmStringFree(str);
  6237.         XtUnmanageChild(
  6238.             XmMessageBoxGetChild(dialog, XmDIALOG_OK_BUTTON));
  6239.         if (interruptable) {
  6240.             str = XmStringCreateSimple("Stop");
  6241.             XtVaSetValues(dialog, XmNcancelLabelString, str, NULL);
  6242.             XmStringFree(str);
  6243.             XtAddCallback(dialog, XmNcancelCallback, stop, NULL);
  6244.         } else
  6245.             XtUnmanageChild(
  6246.                 XmMessageBoxGetChild(dialog, XmDIALOG_CANCEL_BUTTON));
  6247.         XtUnmanageChild(
  6248.             XmMessageBoxGetChild(dialog, XmDIALOG_HELP_BUTTON));
  6249.         XtManageChild(dialog);
  6250.     } else {
  6251.         /* get rid of all button and keyboard events that occured
  6252.          * during the time out.  The user shouldn't have done anything
  6253.          * during this time, so flush for button and keypress events.
  6254.          * KeyRelease events are not discarded because accelerators
  6255.          * require the corresponding release event before normal input
  6256.          * can continue.
  6257.          */
  6258.         while (XCheckMaskEvent(dpy,
  6259.                 ButtonPressMask | ButtonReleaseMask | ButtonMotionMask
  6260.                 | PointerMotionMask | KeyPressMask, &event)) {
  6261.             /* do nothing */;
  6262.         }
  6263.         XtDestroyWidget(dialog);
  6264.     }
  6265. }
  6266.  
  6267. /* User Pressed the "Stop" button in dialog. */
  6268. void
  6269. stop(dialog)
  6270. Widget dialog;
  6271. {
  6272.     stopped = True;
  6273. }
  6274.  
  6275. Boolean
  6276. CheckForInterrupt()
  6277. {
  6278.     extern Widget shell;
  6279.     Display *dpy = XtDisplay(shell);
  6280.     Window win = XtWindow(dialog);
  6281.     XEvent event;
  6282.  
  6283.     /* Make sure all our requests get to the server */
  6284.     XFlush(dpy);
  6285.  
  6286.     /* Let motif process all pending exposure events for us. */
  6287.     XmUpdateDisplay(shell);
  6288.  
  6289.     /* Check the event loop for events in the dialog ("Stop"?) */
  6290.     while (XCheckMaskEvent(dpy,
  6291.             ButtonPressMask | ButtonReleaseMask | ButtonMotionMask |
  6292.             PointerMotionMask | KeyPressMask | KeyReleaseMask,
  6293.             &event)) {
  6294.         /* got an "interesting" event. */
  6295.         if (event.xany.window == win)
  6296.             XtDispatchEvent(&event); /* it's in our dialog.. */
  6297.         else /* uninteresting event--throw it away and sound bell */
  6298.             XBell(dpy, 50);
  6299.     }
  6300.     return stopped;
  6301. }
  6302.  
  6303.  
  6304. -----------------------------------------------------------------------------
  6305. Subject: 166)  Can I use the hourglass that mwm uses?
  6306.  
  6307. [Last modified: March 93]
  6308.  
  6309. Answer: The hourglass used by mwm is hard-coded into code that is subject to
  6310. OSF copyright. In Motif 1.2 though, the bitmaps for this and other things
  6311. (information, no_enter, question, warning, working) were made available.  The
  6312. install process will probably add them to /usr/include/X11/bitmaps.
  6313. Otherwise, just use the watch cursor XC_watch of the previous question,
  6314. because that has the same semantics.
  6315.  
  6316.  
  6317.  
  6318. -----------------------------------------------------------------------------
  6319. Subject: 167)  What order should the libraries be linked in?
  6320.  
  6321. [Last modified: August 92]
  6322.  
  6323. Answer: At link time, use the library order  -lXm -lXt -lX11. There are two
  6324. reasons for this (dbrooks@osf.org):
  6325.  
  6326. On most systems, the order matters because the linker won't re-scan a library
  6327. once it is done with it.  Thus any references to Xlib calls from Xm will
  6328. probably be unresolved.
  6329.  
  6330. The [other] problem is that there are two VendorShell widgets. A dummy is
  6331. provided in the Xt library, but a widget set will rely on its own being
  6332. referenced.  If you mention Xt first, the linker will choose the wrong one.
  6333.  
  6334. Motif code will wrongly assume the Motif VendorShell has been class-
  6335. initialized [and will probably crash].
  6336.  Xaw has a similar problem, but a softer landing; it only complains about
  6337. unregistered converters.
  6338.  
  6339.  
  6340. -----------------------------------------------------------------------------
  6341. Subject: 168)  How do I use xmkmf for Motif clients?
  6342.  
  6343. [Last modified: October 1992]
  6344.  
  6345. Answer: This advice comes from dbrooks@osf.org:
  6346.  
  6347. There are a number of intractable problems with using X configuration files
  6348. and xmkmf, while trying to make it easy to build Motif.  Not the least of
  6349. these, but one I've never heard mentioned yet, is that the rules for
  6350. contructing the names of shared library macros are machine-dependent, and in
  6351. the various xxxLib.tmpl files.  Do we edit all those files to add definitions
  6352. for XMLIB, DEPXMLIB, etc., or do we put a maze of #ifdefs into the Motif.tmpl
  6353. file?
  6354.  
  6355. Please note that, if you install Motif, it overwrites your installed
  6356. Imake.tmpl with one that includes Motif.tmpl and Motif.rules.
  6357.  
  6358. With those caveats, I think the following guidelines will help.
  6359.  
  6360. David Brooks OSF
  6361.  
  6362. Clients in the X11R5 release use the xmkmf command to build Makefiles.  In
  6363. general, the xmkmf command cannot be used for Motif clients, because of the
  6364. need to consider the UseInstalledMotif flag separately.  Since xmkmf is a
  6365. simple script that calls imake, it is easy to construct the proper call to
  6366. imake using the following rules.
  6367.  
  6368. In the following, replace {MTOP} by the toplevel directory with the Motif
  6369. source tree, and {XTOP} by the toplevel ("mit") directory with the X source.
  6370. It is assumed that the directory containing your installed imake is in your
  6371. PATH.
  6372.  
  6373. When needed, the imake variables XTop and MTop are normally set in your
  6374. site.def (to {XTOP} amd {MTOP} respectively); however they may also be set
  6375. with additional -D arguments to imake.
  6376.  
  6377. 1. With both X and Motif in their source trees, ensure the imake variables
  6378.    XTop and MTop are set, and use:
  6379.  
  6380.         ${XTOP}/config/imake -I{MTOP}/config
  6381.  
  6382. 2. With Motif in its source tree, and X installed, ensure MTop is set, and
  6383.    use:
  6384.  
  6385.         imake -I{MTOP}/config -DUseInstalled
  6386.  
  6387. 3. With both Motif and X installed, and a nonstandard ProjectRoot (see
  6388.    site.def for an explanation of this), use:
  6389.  
  6390.         imake -DUseInstalled -DUseInstalledMotif -I{ProjectRoot}/lib/X11/config
  6391.  
  6392.    or, if the configuration files are in /usr/lib/X11/config:
  6393.  
  6394.         imake -DUseInstalled -DUseInstalledMotif
  6395.  
  6396.  
  6397. To build a simple Imakefile, remember to include lines like this:
  6398.  
  6399.         LOCAL_LIBRARIES = XmClientLibs
  6400.                 DEPLIBS = XmClientDepLibs
  6401.  
  6402. Or, for a client that uses uil/mrm, replace these by MrmClientLibs and
  6403. MrmClientDepLibs, and also use:
  6404.  
  6405.         MSimpleUilTarget(program)
  6406.  
  6407. to build the client and uid file.  Look at the demos for more examples.
  6408.  
  6409.  
  6410. And Paul Howell <grue@engin.umich.edu> added:
  6411.  
  6412. i did this, calling the new script "xmmkmf".  It passes both -DUseInstalled
  6413. and -DUseInstalledMotif.
  6414.  
  6415. and i modified the stock R5 Imake.tmpl to do this:
  6416.  
  6417. #include <Project.tmpl>
  6418. #ifdef UseInstalledMotif
  6419. #include <Motif.tmpl>
  6420. #endif
  6421.  
  6422. #include <Imake.rules>
  6423. #ifdef UseInstalledMotif
  6424. #include <Motif.rules>
  6425. #endif
  6426.  
  6427. the result was something that does both athena and motif rules.  and it really
  6428. works, just that easy!
  6429.  
  6430.  
  6431. -----------------------------------------------------------------------------
  6432. Subject: 169)  How do I make context sensitive help?  The Motif Style Guide
  6433. says that an application must initiate context-sensitive help by changing the
  6434. shape of the pointer to the question pointer. When the user moves the pointer
  6435. to the component help is wanted on and presses BSelect, any available context
  6436. sensitive help for the component must be presented, and the pointer reverts
  6437. from the question pointer.
  6438. [Last modified: August 92]
  6439.  
  6440. Answer: A widget that gives context sensitive help would place this help in
  6441. the XmNhelpCallback function. To trigger this function: (from Martin G C
  6442. Davies, mgcd@se.alcbel.be)
  6443.  
  6444. I use the following callback that is called when the "On Context" help
  6445. pulldown menu is selected. It does the arrow bit and calls the help callbacks
  6446. for the widget. It also zips up the widget tree looking for help if needs be.
  6447. I don't restrict the arrows motion so I can get help on dialog boxes. No
  6448. prizes for guessing what "popup_message" does.
  6449.  
  6450.  
  6451. static void ContextHelp(
  6452.     Widget              w ,
  6453.     Opaque              * tag ,
  6454.     XmAnyCallbackStruct * callback_struct
  6455. )
  6456. {
  6457.     static Cursor   context_cursor = NULL ;
  6458.     Widget          context_widget ;
  6459.  
  6460.     if ( context_cursor == NULL )
  6461.         context_cursor = XCreateFontCursor( display, XC_question_arrow ) ;
  6462.  
  6463.     context_widget = XmTrackingLocate( top_level_widget,
  6464.                                 context_cursor, FALSE ) ;
  6465.  
  6466.     if ( context_widget != NULL ) /* otherwise its not a widget */
  6467.     {
  6468.         XmAnyCallbackStruct cb ;
  6469.  
  6470.         cb.reason = XmCR_HELP ;
  6471.         cb.event = callback_struct->event ;
  6472.  
  6473.         /*
  6474.          * If there's no help at this widget we'll track back
  6475.            up the hierarchy trying to find some.
  6476.          */
  6477.  
  6478.         do
  6479.         {
  6480.             if ( ( XtHasCallbacks( context_widget, XmNhelpCallback ) ==
  6481.                                                 XtCallbackHasSome ) )
  6482.             {
  6483.                 XtCallCallbacks( context_widget, XmNhelpCallback, & cb ) ;
  6484.                 return ;
  6485.             }
  6486.             else
  6487.                 context_widget = XtParent( context_widget ) ;
  6488.         } while ( context_widget != NULL ) ;
  6489.     }
  6490.  
  6491.     popup_message( "No context-sensitive help found\n\
  6492. for the selected object." ) ;
  6493. }
  6494.  
  6495.  
  6496.  
  6497. Dave Bonnett suggested, to use the following translations for XmText (and
  6498. XmTextField) widgets to get the same help with key strokes, and to provide an
  6499. accelerator label in the Context help menu entry.
  6500.  
  6501. MyApp*XmText*translations: #override\n\
  6502.                                 <Key>F1:    Help()
  6503.  
  6504. MyApp*Help_menu*Contextual Help.acceleratorText:   F1
  6505.  
  6506. MyApp*defaultVirtualBindings:           osfBackSpace : <Key>Delete\n\
  6507.                                         osfRight : <Key>Right\n\
  6508.                                         osfLeft  : <Key>Left\n\
  6509.                                         osfUp    : <Key>Up\n\
  6510.                                         osfHelp  : <Key>F1\n\
  6511.                                         osfDown  : <Key>Down
  6512.  
  6513.  
  6514. -----------------------------------------------------------------------------
  6515. Subject: 170)  How do I debug a modal interaction?
  6516.  
  6517. When an application crashes in a modal section (such as in a modal dialog, a
  6518. menu or when a drag and drop is in action), I cannot access the debugger.
  6519.  
  6520. [Last modified: January 1993]
  6521.  
  6522. Answer: Run the debugger on one display while the application writes to
  6523. another display.  ---------
  6524. --------------------------------------------------------------------
  6525. Subject: 171)+ How can I disable Drag and Drop in my Motif 1.2 client ?
  6526.  
  6527. [Last modified: December]
  6528.  
  6529. Answer: Set the XmDisplay drag-protocol resources to XmDRAG_NONE.
  6530.         The following code fragment demonstrates this:
  6531.  
  6532. #include <Xm/Display.h>
  6533.  
  6534.  
  6535.     dw = XmGetXmDisplay(XtDisplay(shell));
  6536.     /* where "shell" is your client's top-level shell. */
  6537.  
  6538.     XtVaSetValues(dw, XmNdragInitiatorProtocolStyle, XmDRAG_NONE, NULL);
  6539.     XtVaSetValues(dw, XmNdragReceiverProtocolStyle,  XmDRAG_NONE, NULL);
  6540.  
  6541.  
  6542. thanks to Lance Purple (purple@austin.ibm.com)
  6543.  
  6544. -----------------------------------------------------------------------------
  6545. Subject: 172)  Where can I get info on the Motif drag and drop protocol?
  6546.  
  6547. [Last modified: March]
  6548.  
  6549. Answer: The drag and drop protocol implemented by OSF is not stable, so they
  6550. have not published it yet. The API should remain stable though.  The OSF
  6551. protocol is not compatable with the OpenLook protocol.  OSF and Sun are
  6552. working on a joint protocol for publication.
  6553.  
  6554. For programming examples on Motif D&D, see the Motif 1.2 Programmers Guide.
  6555.  
  6556. For a third alternative, try Roger Reynolds D&D protocol, available from
  6557. netcom.com in /pub/rogerr.
  6558.  
  6559. -----------------------------------------------------------------------------
  6560. Subject: 173)  TOPIC: ACKNOWLEDGEMENTS
  6561.  
  6562. This list was compiled using questions and answers posed to
  6563. comp.windows.x.motif and motif-talk. Some extracts were also taken from FAQs
  6564. of comp.windows.x.  To all who contributed one way or the other, thanks! I
  6565. haven't often given individual references, but  you may recognise
  6566. contributions. If I have mangled them too much, let me know.
  6567.  
  6568.  
  6569.  
  6570. +----------------------+---+
  6571.   Jan Newmarch, Information Science and Engineering,
  6572.   University of Canberra, PO Box 1, Belconnen, Act 2616
  6573.   Australia. Tel: (Aust) 6-2522422. Fax: (Aust) 6-2522999
  6574.  
  6575.   ACSnet: jan@ise.canberra.edu.au
  6576.   ARPA:   jan%ise.canberra.edu.au@uunet.uu.net
  6577.   UUCP:   {uunet,ukc}!munnari!ise.canberra.edu.au!jan
  6578.   JANET:  jan%au.edu.canberra.ise@EAN-RELAY
  6579.  
  6580.  
  6581. Jan Newmarch of  has been maintaining this FAQ and has really helped a great
  6582. many of us by providing this valuable service.  He deserves a big round of
  6583. applause for his efforts.  I use this resource all the time and it has saved
  6584. me countless hours with manual and source code trying to relearn what others
  6585. have already discovered.  Jan`s efforts are gratefully acknowledged here.
  6586.  
  6587. I am maintaining the FAQ now and will strive to maintain the quality
  6588. that Jan has acheived. Enjoy!
  6589. Brian
  6590.  
  6591. Brian Dealy - X Professional Organization
  6592. dealy@kong.gsfc.nasa.gov
  6593.  
  6594.  
  6595. (301) 572-8267
  6596. (410) 799-7197 (FAX)
  6597. +--------------------------+
  6598. -- 
  6599. ..........................
  6600.  
  6601.